Deploy a fine-tuned model
By default, when you create a fine-tuning run, your fine-tuned model will be automatically deployed as soon as the run finishes.
However, if you elected to not automatically deploy by setting
FinetuningRun.create(), use the steps in this page to manually deploy your model.
Your fine-tuning run needs to finish before you can deploy the fine-tuned model.
from baseten.training import FinetuningRun my_run = FinetuningRun("RUN_ID") my_run.is_succeeded # Once True, you're ready to deploy
You'll receive an email when the fine-tuning run finishes.
When your run is finished, it's time to deploy the model. It's a one-line command:
idle_time_minutes controls the time the model waits after its most recent invocation before scaling to zero.
- A lower
idle_time_minutessaves you money on model hosting.
- A higher
idle_time_minutesmeans fewer model invocations have a cold start. Cold starts slow down the first call to a model.
You'll receive an email when model deployment finishes.
Once your model is deployed, you can invoke it:
from baseten.models import StableDiffusionPipeline model = StableDiffusionPipeline(model_id="MODEL_ID") image, url = model("portrait of olliedog as an andy warhol painting") image.save("ollie-warhol.png")
The model returns:
- The generated image (using Pillow)
- A URL to the generated image
For more on your newly deployed model, see the
These images were generated for the following prompts:
portrait of olliedog as an andy warhol painting(left)
side profile of olliedog as a van gogh painting(right)