Sample published weights
Request a sampling client from a training client withsave_weights_and_get_sampling_client(). It publishes the current weights and returns a client for them.
To sample from weights you saved with save_weights_for_sampler(), pass the returned path to TrainingClient.create_sampling_client(). Then call sample() with a tokenized prompt. To generate one completion from the saved weights and print it, run:
with_sampler=True in create_lora_training_client(), and the run creates its paired sampler with the trainer. Leave it off for runs that only train, so the run doesn’t provision a sampler.
Weight sync
Publishing sampler weights makes a checkpoint available to the run’s paired sampler. What a sampling client serves afterward depends on the availability mode:- Serverless: Loops pins the client to the published checkpoint. Publish again and use the returned client to sample from later weights. Each publish needs a name the run hasn’t used; see Save a checkpoint.
- Dedicated: The client serves the published weights or later ones. The paired sampler loads newly published weights without restarting, so the client doesn’t stay on an exact snapshot.
TrainingClient.policy_version reports the trainer’s optimizer-step count, which is the policy version that a client tracks. The serverless mode doesn’t support it.
A paired sampler accepts checkpoints with the run’s LoRA configuration. To sample from a checkpoint with a different LoRA configuration, create a standalone sampler.
Next steps
- Set sampling parameters: Control temperature, cut-offs, length, and stop sequences.
- Router replay: Record the experts that a mixture-of-experts sampler chose so the trainer can replay them.
- Save a checkpoint: Save the weights that a sampler serves.