# Fine-tune with LoRA (sequence packing and gradient checkpointing are on by default)
pmetal train --model Qwen/Qwen3-0.6B --dataset train.jsonl --output ./output \
--lora-r 16 --batch-size 4 --learning-rate 2e-4
# Run it with the adapter, then serve it
pmetal infer --model Qwen/Qwen3-0.6B --lora ./output/adapter_model.safetensors \
--prompt "Explain quantum entanglement" --chat
pmetal serve --model Qwen/Qwen3-0.6B --port 8080
import pmetal
# Fine-tune in this process (releases the GIL; Ctrl-C stops after the step and keeps the weights)
spec = pmetal.TrainSpec(model="Qwen/Qwen3-0.6B", dataset="train.jsonl", epochs=3, lora_r=16)
result = pmetal.Trainer(spec, callbacks=[pmetal.LoggingCallback(10)]).train()
print(result.final_loss, result.total_steps, result.weights_path)
# Inference
model = pmetal.Model.load("Qwen/Qwen3-0.6B")
print(model.generate("The capital of France is", max_tokens=16, temperature=0.0))
use pmetal::trainer::orchestrator::{TrainingJobConfig, run_training};
let config = TrainingJobConfig {
model_id: "Qwen/Qwen3-0.6B".to_string(),
dataset: "train.jsonl".to_string(),
output_dir: "./output".to_string(),
..Default::default()
};
let result = run_training(config, None, Vec::new()).await?;
println!("final loss {:.4} over {} steps", result.final_loss, result.total_steps);
pmetal serve --model Qwen/Qwen3-0.6B --port 8080
# Query with curl
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model": "Qwen/Qwen3-0.6B", "messages": [{"role": "user", "content": "Hello"}]}'