Skip to content

Fine-tuning runs

A FinetuningRun is the core object that controls kicking off, monitoring, and managing fine-tuning runs.

Before fine-tuning a model, make sure your local setup is complete.

Instantiation

If you already have a fine-tuning run that's running, or has run, you can grab the ID from the Blueprint Web UI (or from FinetuningRun.list()) and instantiate it as such:

from baseten.training import FinetuningRun 

finetuning_run = FinetuningRun(id="my_id")

With your FinetuningRun, you can now manage your fine-tuning run, deploy a fine-tuned model or view logs.

Kicking off a run

To kick off a fine-tuning run, FinetuningRun expects 2 things:

  1. A FinetuningConfig (which also contains a pointer to a Dataset)
  2. A name, which applies to the run and the eventual deployed model
from baseten.training import FinetuningRun

finetuning_run = FinetuningRun.create(
    trained_model_name="My model", 
    fine_tuning_config=config
)

See details for:

Stream logs from a run

You can stream logs during or after fine-tuning using the Blueprint SDK:

from baseten.training import FinetuningRun 

finetuning_run = FinetuningRun(id="my_id")
finetuning_run.stream_logs()

To view all of the functionality of FinetuningRun, visit the reference doc.

Deploying the fine-tuned model

Once the fine-tuning run is complete, your model will be automatically deployed. You'll receive an email when the deployment is finished and the model is ready to invoke.

You can turn off this behavior by setting auto_deploy=False in FinetuningRun.create() and instead deploy your model manually.