FinetuningRun
FinetuningRun
Class to represent a single finetuning run.
Examples:
Instantiate a new fine-tuning run and stream logs
from baseten.training import FinetuningRun
my_run = FinetuningRun.create(
trained_model_name="My Model",
fine_tuning_config=config
)
my_run.stream_logs()
Access an existing fine-tuning run
Initialize the object with the given id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
Optional[str]
|
The ID of the FinetuningRun on Blueprint |
None
|
trained_model_name |
Optional[str]
|
Name of the FinetuningRun on Blueprint |
None
|
status
property
Get the status of your FinetuningRun. Statuses are:
- PENDING: The run has not yet started
- RUNNING: The run is actively fine-tuning the model
- SUCCEEDED: The run is finished and fine-tuned the model
- FAILED: The run hit an error and did not fine-tune the model
- CANCELLED: The run was cancelled by a user
Example
blueprint_url
property
create
staticmethod
create(
trained_model_name: str,
fine_tuning_config: FinetuningConfig,
auto_deploy: bool = True,
verbose: bool = True,
) -> Optional[FinetuningRun]
Fine-tune a model by creating a FinetuningRun
Example:
from baseten.training import FinetuningRun
my_run = FinetuningRun.create(
trained_model_name="My Model",
fine_tuning_config=config
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trained_model_name |
str
|
The name you want your fine-tuned model to have |
required |
fine_tuning_config |
FinetuningConfig
|
The configuration for the fine-tuning process |
required |
auto_deploy |
bool
|
Flag for whether or not the model should be deployed after finetuning is complete. |
True
|
verbose |
bool
|
Toggle this for verbose output |
True
|
Returns:
Name | Type | Description |
---|---|---|
FinetuningRun |
Optional[FinetuningRun]
|
The newly created FinetuningRun on Blueprint |
list
staticmethod
deploy
Deploy the fine-tuned model created during the FinetuningRun
Example
from baseten.training import FinetuningRun
my_run = FinetuningRun("RUN_ID")
# After the run is finished
my_run.deploy()
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idle_time_minutes |
int
|
How long the deployed model should wait between invocations before scaling resources to zero |
30
|
verbose |
bool
|
Toggle this for verbose output |
True
|
Returns:
Name | Type | Description |
---|---|---|
StableDiffusionPipeline |
FoundationalModel
|
A model object using the finetuning run results |