页面简介
Move managed SFT and DPO jobs to the Training API: clone an existing job with its settings, or start a new job with the settings you choose.
正文摘录
Managed supervised fine-tuning (SFT) and DPO no longer accept new jobs. Train on the Training API instead. Models and LoRA adapters from managed jobs stay in your account and stay deployable. Clone an existing jobRerun a managed job on the Training API with its settings.Start a new jobPick the model, data and settings yourself, and get a price estimate first. Bring your own copy of the training data. The Training API reads your training file directly: a local JSONL file, a directory of .jsonl shards, or a Google Cloud Storage path (gs://<BUCKET>/train.jsonl). It can’t read datasets stored in Fireworks (accounts/<ACCOUNT_ID>/datasets/<DATASET_ID>). Use the same file you uploaded for the managed job, and its evaluation file if it had one. The row format doesn’t change, except that the DPO and ORPO recipes don’t read tool definitions in a row’s input.tools. For data in Amazon S3 or Azure Blob Storage, copy it to a local file or to Cloud Storage first. Clone an existing job Migration tool: migrate_managed_job.py in the Fireworks cookbook. It reads your old job’s settings, maps them onto the matching training recipe, runs it, and promotes the result to a new model. See the tool README for how each setting maps. Paste this into Claude Code, Cursor, Codex or another coding agent, from the folder that holds your training data. Fill in the values in square brackets; the FAQ shows where to find your job name and account ID. Set FIREWORKS_API_KEY in your shell before you start the agent, and never paste the key into the agent chat. See FAQ: “How do I keep my API key safe with a coding agent?” Set up Fireworks training for me: fetch https://docs.fireworks.ai/fine-tuning/agent/use-with-coding-agents.md and follow it. Then clone my managed fine-tuning job to the Training API with its settings, following https://docs.fireworks.ai/fine-tuning/migrate-from-managed-training.md. - Job: [accounts/ACCOUNT_ID/supervisedFineTuningJobs/JOB_ID, or for DPO: accounts/ACCOUNT_ID/dpoJobs/JOB_ID] - Training data: [./train.jsonl] - New model ID: [NEW_MODEL_ID] My API key is already set as FIREWORKS_API_KEY in this shell. Never ask me to paste it, and never print it. Do a dry run first. Show me the plan and its warnings, and wait for my approval before you start training. Run it with the Python API insteadSet up once. Create an API key in the account that owns the job, in the dashboard or with firectl api-key create. The Training API rejects keys that can reach more than one account. If you belong to several Fireworks accounts, use a service account key created in the job’s account. Install Python 3.11 or newer and uv. read -s FIREWORKS_API_KEY && export FIREWORKS_API_KEY git clone https://github.com/fw-ai-external/cookbook.git cd cookbook/training uv venv --python 3.12 && source .venv/bin/activate uv pip install -e . Call the migration tool from Python, and review the plan before you train:import logging import os from training.examples.tools.migrate_managed_job import ( FireworksReader, MigrationInputs, describe_plan, read_plan, run_plan, ) logging.basicConfig(level=logging.INFO) plan = read_plan( FireworksReader(os.environ["FIREWORKS_API_KEY"]), MigrationInputs( dataset_path="./train.jsonl", output_model_id="<NEW_MODEL_ID>", log_path="./migrated_runs/<JOB_ID>", ), "accounts/<ACCOUNT_ID>/supervisedFineTuningJobs/<JOB_ID>", ) print(describe_plan(plan)) # the recipe, serverless or dedicated, the full config, and warnings run_plan(plan) For a DPO or ORPO job, pass accounts/<ACCOUNT_ID>/dpoJobs/<JOB_ID>. MigrationInputs also takes eval_dataset_path, mode ("auto", "serverless" or "dedicated"), tokenizer_model and max_seq_len. plan.config is the recipe Config the run uses. Check it, and the warnings describe_plan prints, before you call run_plan. The tool saves a resumable checkpoint every 50 steps (managed jobs saved one every 20). LoRA SFT and DPO runs also save one every 30 minutes, as managed jobs did. Run, watch and resume The training loop runs in your Python process for the whole job, not on Fireworks. If the process stops, training stops. For long runs, use a machine that stays on, such as a cloud VM, and keep the output in a log file: nohup python train.py > train.log 2>&1 &. Watch the loss in the log, in Weights & Biases, or on the training dashboard. If the run stops with an error or Ctrl-C, the tool prints how to continue it from its newest checkpoint, as command-line flags. In Python, pass the same log_path and the printed init_from_checkpoint or trainer_job_id to MigrationInputs. Lost the output? See “My run stopped. How do I resume it?” in the FAQ. A dedicated trainer stops after 60 minutes without activity. If your process dies, the trainer keeps billing until then. Start a new job Training recipes: sft_loop.py and dpo_loop.py in the Fireworks cookbook. Each one runs the whole job from your data to a deployable model. For step-by-step guides, see Cookbook: SFT and Cookbook: DPO. Use this path if you have no managed job to clone, for example because you only used the dashboard, or if you want different settings. Paste this into your coding agent, from the folder that holds your training data. Fill in the values in square brackets. Leave a setting as [default] to let the agent choose it and show you its choice in the plan. Set up Fireworks training for me: fetch https://docs.fireworks.ai/fine-tuning/agent/use-with-coding-agents.md and follow it. Then start a new training job on the Fireworks Training API, following https://docs.fireworks.ai/fine-tuning/migrate-from-managed-training.md. - Method: [SFT or DPO] - Base model: [BASE_MODEL, for example Qwen3 8B] - Training data: [./train.jsonl] - Evaluation data: [none, or ./eval.jsonl] - New model ID: [NEW_MODEL_ID] - Epochs: [default] (whole number, usually 1–3) - Learning rate: [default] (usually 5e-5 to 1.5e-4 for SFT, about 1e-5 for DPO) - LoRA rank: [default] (usually 8–32; up to 64 on most serverless models) - Batch size: [default] (rows per step for SFT, preference pairs per step for DPO) - Max context length: [default] (tokens; your longest example, up to the model's maximum) - Weights & Biases entity: [none] (or your W&B username or team; set WANDB_API_KEY first) My API key is already set as FIREWORKS_API_KEY in this shell. Never ask me to paste it, and never print it. Check my data first. Then show me the full configuration and a price estimate, and wait for my approval before you start training. Run it with the Python API insteadSet up as in Clone an existing job, then build the recipe Config and run it. These examples train a LoRA adapter on serverless training, which needs no provisioning and bills per token. Every setting is a field on the recipe’s Config.SFTDPOimport logging import training.recipes.sft_loop as sft_loop logging.basicConfig(level=logging.INFO) sft_loop.main( sft_loop.Config( serverless=True, log_path="./runs/<NEW_MODEL_ID>", base_model="accounts/fireworks/models/<BASE_MODEL>", tokenizer_model="<HF_ORG>/<HF_REPO>", dataset="./train.jsonl", evaluation_dataset="./eval.jsonl", # optional output_model_id="<NEW_MODEL_ID>", epochs=1, learning_rate=1e-4, warmup_steps=10, lora_rank=16, lora_alpha=32, weight_decay=0.01, batch_size=32, max_seq_len=32768, dcp_save_interval=20, # resumable checkpoint every 20 steps ) ) serverless=True works only on the serverless models. For any other base model, remove it to train on a dedicated trainer; see “Should I use Serverless or Dedicated Training?” in the FAQ. Always set lora_rank. The recipe default of 0 means full-parameter training, which needs a dedicated trainer. tokenizer_model is the Hugging Face repo of the base model, such as Qwen/Qwen3-8B. A mismatch corrupts training. For a gs:// dataset, also set dataset_loading_mode="stream", install google-cloud-storage, and sign in with gcloud auth application-default login. For Weights & Biases charts, pass wandb=WandBConfig(entity="<WANDB_ENTITY>") (from training.utils) and set WANDB_API_KEY. Run, watch and resume The training loop runs in your Python process for the whole job, not on Fireworks. If the process stops, training stops. For long runs, use a machine that stays on, such as a cloud VM, and keep the output in a log file: nohup python train.py > train.log 2>&1 &. Watch the loss in the log, in Weights & Biases, or on the training dashboard. For SFT the loss should fall over the first epoch. For DPO, dpo_loss starts near 0.69 and should fall while accuracy rises. If a serverless run stops, rerun it with the same log_path and init_from_checkpoint="<ACCOUNT_ID>/<RUN_ID>/<CHECKPOINT>". “My run stopped. How do I resume it?” in the FAQ shows where to find each value. On a dedicated trainer, reattach with trainer=TrainerConfig(job_id="<TRAINER_JOB_ID>") while the trainer is still running, or start a new trainer from the checkpoint. A dedicated trainer stops after 60 minutes without activity, and keeps billing until then if your process dies. See Checkpoints and resume for details. Deploy the new model The run promotes its final checkpoint to accounts/<ACCOUNT_ID>/models/<NEW_MODEL_ID>. Deploy it from Models in the Fireworks app, or run: firectl deployment create accounts/<ACCOUNT_ID>/models/<NEW_MODEL_ID> See Deploying trained models for multi-LoRA deployments. What keeps working For managed SFT, DPO and ORPO jobs created before November 9, 2026: Jobs that are queued or running finish normally. You can get, list, cancel and delete them in the dashboard, with firectl, and through the API. You can export DPO job metrics (firectl dpo-job export-metrics) and promote the checkpoints of existing jobs. You can’t resume a failed or cancelled job. Start a new job on the Training API instead. The models they produced stay in your account and deploy as before. Reference for existing jobs Managed Training overview: view, stop, delete, and re-run existing jobs Supervised Fine-Tuning: dataset format and job settings Preference Optimization (DPO and ORPO): dataset format and monitoring Troub