Appearance
Saving and Loading
Guide to saving trained model weights and loading them for inference.
Overview
Weaver provides simple APIs for:
- Saving model weights after training
- Loading saved weights for inference
- Managing multiple model checkpoints
Saving Weights
save_weights_for_sampler()
Save model weights and get a sampling client:
python
from weaver import ServiceClient
# After training
sampling_client = training_client.save_weights_and_get_sampling_client(
name="my-trained-model"
)
# Now you can sample from the trained model
result = sampling_client.sample(...)Parameters:
name(str): Name for this saved model
Returns:
A SamplingClient ready to generate text from the trained model.
Save Path
The method returns the path where weights were saved:
python
save_path = training_client.save_weights_for_sampler(name="checkpoint-100")
print(f"Weights saved to: {save_path}")This path can be used later to create a sampling client.
Loading Weights
create_sampling_client()
Create a sampling client from saved weights:
python
from weaver import ServiceClient
service_client = ServiceClient()
# Load from saved path
sampling_client = service_client.create_sampling_client(
model_path="/path/to/saved/weights",
base_model="Qwen/Qwen3-8B",
)
# Sample from loaded model
result = sampling_client.sample(...)Parameters:
model_path(str): Path to saved model weightsbase_model(str): Base model identifiermodel_id(str, optional): Model ID for tracking
Next Steps
- Learn about Training and Sampling - Core APIs
- Explore Loss Functions - Available losses
- Check Model Lineup - Supported models