Fine-tuning and adapters
Fine-tuning trains a LoRA adapter on your examples. The base model does not change. A deployment of the base model can then serve the adapter, next to up to 63 other adapters.
Before you start#
- The base model must be a hub model of your organization that was deployed once.
- You need a key with the scope
deploy, or the CLI signed in. - Prepare the training data as JSON lines. Each line is one conversation.
{
"messages": [
{ "role": "user", "content": "Reset my password" },
{ "role": "assistant", "content": "Open Settings, then select Reset." }
]
}
The file can have at most 1 GiB.
Start a job#
ember fine-tune create \
--model mdl_xxxxxxxxxxxx \
--data train.jsonl \
--adapter-name support-tone \
--gpu-class l40s --epochs 3 --rank 16 --learning-rate 0.0002
The CLI uploads the data to storage in your region, then starts the job.
| Setting | Values | Default |
|---|---|---|
--epochs | 1 to 10 | 3 |
--rank | 8, 16, 32 or 64 | 16 |
--learning-rate | 0.000001 to 0.01 | 0.0002 |
--gpu-class | l4, l40s, h100, h200, b200 | l40s |
Follow a job#
The dashboard page Fine-tuning shows each job, its status and how long it ran. You can also use ember fine-tune get <job ID>.
| Status | Meaning |
|---|---|
queued | The job waits for a GPU. |
running | The job trains. |
succeeded | The adapter is made. Nuemetrix checks it before it is ready. |
failed | The job stopped. error_code tells you why. |
cancelled | You cancelled the job. |
To stop a job, select Cancel in the dashboard, or use ember fine-tune cancel <job ID>.
Your training data#
The training data is deleted when the job ends, also after a failure or a cancel. The dashboard shows when the data is deleted.
Serve the adapter#
ember fine-tune deploy <job ID> --deployment dep_xxxxxx
The command waits until the adapter is checked, then adds it to the deployment. In a request, name the adapter as <deployment ID>:<adapter ID>.
curl "$EMBER_API_URL/v1/chat/completions" \
-H "Authorization: Bearer $EMBER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "dep_xxxxxx:adp_xxxxxxxxxxxx", "messages": [{"role": "user", "content": "Hello"}]}'
Register an adapter#
You can also register an adapter that you trained in another place. Use ember adapters create with a hub repository or a folder. The folder must have only adapter_config.json and adapter_model.safetensors. Nuemetrix checks the files before the adapter is ready.
Delete an adapter#
Select Delete in the Adapters section of the Models page. You cannot delete an adapter while a deployment serves it.