Skip to content
Edit on GitHub

Fast.ai

DVCLive allows you to add experiment tracking capabilities to your Fast.ai projects.

Usage

To start using DVCLive, add a few lines to your training code in any Fast.ai project.

Include the DvcLiveCallback int the callbacks list passed to your Learner:

+from dvclive.fastai import DvcLiveCallback

...

learn = tabular_learner(data_loader, metrics=accuracy)
learn.fit_one_cycle(
-  n_epoch=2)
+  n_epoch=2,
+  cbs=[DvcLiveCallback()])

The history of each {metric} will be stored in:

{Live.dir}/scalars/{split}/{metric}.tsv

Where:

  • {Live.dir} is the dir attribute of Live.
  • {split} can be either train or eval.
  • {metric} is the name provided by the framework.

Without requiring additional modifications to your training code, you can use DVCLive alongside DVC. See DVCLive with DVC for more info.

Parameters

  • model_file - (None by default) - The name of the file where the model will be saved at the end of each step.

  • **kwargs - Any additional arguments will be passed to Live.

Examples

  • Using model_file.
from dvclive.fastai import DvcLiveCallback

learn = tabular_learner(data_loader, metrics=accuracy)
learn.fit_one_cycle(
  n_epoch=2,
  cbs=[DvcLiveCallback(model_file="model.pth")])
  • Using **kwargs to customize Live.
from dvclive.fastai import DvcLiveCallback

learn = tabular_learner(data_loader, metrics=accuracy)
learn.fit_one_cycle(
  n_epoch=2,
  cbs=[DvcLiveCallback(model_file="model.pth", path="custom_path")])
Content

🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat