Supercomputer
Guides

Training API (beta)

Fine-tune a model step by step and sample from it, from the training SDK you already use.

The Training API runs LoRA fine-tuning and sampling loops one call at a time: you send each forward pass, optimizer step and sample, and the service holds the model. It is in closed beta; ask us to turn it on for your account.

You do not need a new client. The API accepts the wire protocol of the open-source tinker Python SDK, so a script written against that SDK runs here with two environment variables changed and no code edits:

pip install tinker
export TINKER_BASE_URL="https://inference.supercomputer.sh"
export TINKER_API_KEY="tml-$SUPERCOMPUTER_API_KEY"   # your account key, prefixed with tml-
import tinker

service = tinker.ServiceClient()
print([m.model_name for m in service.get_server_capabilities().supported_models])

training = service.create_lora_training_client(base_model=MODEL, rank=32)
tokenizer = training.get_tokenizer()

training.forward_backward(batch, loss_fn="cross_entropy").result()
training.optim_step(tinker.AdamParams(learning_rate=1e-4)).result()

sampler = training.save_weights_and_get_sampling_client(name="v1")
out = sampler.sample(prompt, num_samples=1,
                     sampling_params=tinker.SamplingParams(max_tokens=64)).result()

Usage is billed per token against your account credit, on the same meters as the rest of the training API.

What works

CallStatus
create_lora_training_client, create_training_client_from_stateYes
forward_backward, forward with cross_entropy, importance_sampling, ppo, cispo, dro, gspo and custom loss functionsYes
optim_step (Adam)Yes
save_state, load_state, checkpoint expiry (TTL)Yes
save_weights_for_sampler, save_weights_and_get_sampling_clientYes
create_sampling_client for a base model or a saved checkpoint pathYes
sample, including stop token ids, sampled-token and prompt logprobsYes
Downloading your adapter as PEFT files (save_weights_external)Yes
Futures (.result(), cancel), capabilities, run and checkpoint listingYes

Not supported

These return a clear error naming the call rather than hanging:

  • The stable_reinforce loss; use importance_sampling, ppo or cispo
  • publish_checkpoint and copy_weights
  • Loading weights from outside the service

Limits during the beta

  • Models: the trainable models your key can see; list them with get_server_capabilities() as above.
  • Context: 16,384 tokens per sequence.
  • First call: the first step or sample of a session can take a few minutes while the model loads. Later calls on the same session are fast.
  • Checkpoints are saved with every save_state and exported sampler; a session that is interrupted resumes from its last saved state.

Tell us which missing call blocks you and we will move it up.

This service is independent: it is not affiliated with or endorsed by the makers of the SDK, whose name and package belong to them.

On this page