Build a config
Once your config is set, use it to create a
You can get your run's status with:
Once the run starts (
RUNNING), stream logs with:
Monitor your run with Weights & Biases
Blueprint fine-tuning can integrate with Weights & Biases to monitor your fine-tuning run:
wandb_api_key="YOUR_API_KEY"to enable the integration.
image_log_stepsto control how many steps you see images for
This will enable you to see your model generate images as it is being fine-tuned.
If your model doesn't generate the results you'd like, there may be a couple issues:
Learning Rate: Your learning rate might've been too high or too low. A smaller learning rate ensures a more gradual convergence but may require more training time, while a larger learning rate may cause the model to overshoot the optimal solution. To remedy this, you can use the
learning_rateparameter to set your learning rate as well as use the
Dataset: Your dataset might not have enough examples or the examples are poorly formatted. FLAN-T5 may run into issues when your dataset contains non-English characters or special characters (like
<). It's important to remove these and preprocess your dataset before kicking off the job. You may also find that using an existing instruction template found here can improve your model performance.
Weight Decay: You may've overfit or underfit on the dataset. Overfitting is when the model begins to memorize your training data. Underfitting is when the model struggle to find a function that maps from your input data to your output data. You can apply weight decay (L2 regularization) to prevent overfitting and improve generalization. Start with a small weight decay value (e.g., 1e-5 or 1e-4) and experiment with different values to find the right balance between overfitting and underfitting.
Model Size: For certain tasks, smaller models can really struggle with the task. For example, large language models are notoriously bad at math word problems. It may benefit to train your dataset on a larger model that has more parameters. These models can generalize better to more complex tasks, yet they may require longer to train.
FlanT5BaseConfig reference for a complete list of parameters.
Your model will be automatically deployed
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
FinetuningRun.create() and instead deploy your model manually.
Once your model is deployed, you can invoke it:
View our docs on the
FlanT5() model object here
The model returns: