Reference this guide to learn how to fine-tune a model on Together AI using the command-line interface.
together
Python CLI:
TOGETHER_API_KEY
environment variable, like this:
PATH_TO_DATA_FILE
with the path to your dataset.
joke_explanations.jsonl
. Here’s what the output looks like:
FILE_ID
with the ID of the training file.MODEL_NAME
with the API name of the base model you want to fine-tune (refer to the models list).WANDB_API_KEY
with your own Weights & Biases API key (Optional).FILE_ID
with the ID we got when we uploaded the dataset and the MODEL_NAME
with the model we want to use, which in this example, is meta-llama/Meta-Llama-3-8B
. Here’s a sample output:
id
as you’ll need that to track progress and download model weights. For example, from the sample output above, ft-3b883474-f39c-40d9-9d5a-7f97ba9eeb9f
is your Job ID.
A fine-tune job can take anywhere between a couple minutes to hours depending on the base model, dataset size, number of epochs, and job queue. Also, unless you set --quiet
in the CLI, there will be a confirmation step to make sure you are aware of any defaults or arguments that needed to be reset from their original inputs for this specific finetune job.
together fine-tuning retrieve $JOB_ID
in your CLI.
Q: Is there a minimum price? The minimum price for a fine-tuning job is 366. If you fine-tune this model for 1M tokens for 1 epoch, it is 5.
Q: What happens if I cancel my job? The final price will be determined baed on the amount of tokens used to train your model up to the point of the cancellation. For example, if your fine-tuning job is using Llama-3-8B with a batch size of 8, and you cancelled the job after 1000 training steps, the total number of tokens used for training is 8192 [context length] x 8 [batch size] x 1000 [steps] = 65,536,000. This results in $27.21 as you can check in the pricing page.