Skip to main content

Installation

Install the Fireworks Python package with training extensions:
Set your credentials:
If you want ready-to-run recipes instead of writing a loop from scratch, see The Cookbook for config-driven GRPO, DPO, and SFT training.

Your first training loop

This quickstart walks through a minimal SFT loop from scratch using only the API. For trainer launch, the only shape-specific input you provide is the training shape ID. In most cases, use the full shared path accounts/fireworks/trainingShapes/<shape>. The fireworks account is the public shared shape catalog. The SDK-managed service client resolves the pinned version, creates or reattaches the trainer, and returns a Tinker-compatible training client.

Step 1: Create the managed service

Step 2: Create the training client

Step 3: Build training data

Each training example is a Datum — a tokenized sequence with per-token weights indicating which tokens to train on.

Step 4: Write a loss function and train

Step 5: Save and promote

For production scripts, wrap service.close() in try/finally so SDK-managed trainers are cleaned up on exit — including on exceptions. See Cleanup and Teardown.

Next steps