On this page

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.
json
{
  "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#

shell
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.

SettingValuesDefault
--epochs1 to 103
--rank8, 16, 32 or 6416
--learning-rate0.000001 to 0.010.0002
--gpu-classl4, l40s, h100, h200, b200l40s

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>.

StatusMeaning
queuedThe job waits for a GPU.
runningThe job trains.
succeededThe adapter is made. Nuemetrix checks it before it is ready.
failedThe job stopped. error_code tells you why.
cancelledYou 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#

shell
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>.

shell
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.