mirror of
https://github.com/hanzoai/engine.git
synced 2026-11-20 14:17:52 +00:00
run_distill composes the existing primitives: the teacher (loaded with no
adapters — empty target_modules is exactly the base model) samples
completions for a {"prompt"} JSONL set; the generated {prompt, completion}
dataset is written to out/distill.jsonl (kept as an inspectable artifact);
the student LoRA-fine-tunes on it via run_sft into out/adapter. No new
training machinery.
Also DRYs prompt handling onto TrainingClient (encode_prompt/decode) — the
run loop, the /v1/training sample handler, and distill now share one path.
CLI: `hanzo distill --teacher X --student Y --prompts p.jsonl
[--max-tokens/--temperature/--lora-rank/--lr/--steps/...]`.
Verified end-to-end (SmolLM2-135M as both roles): teacher generated real
completions ("The capital of France is" -> " Paris. It is the largest
city in France and"), dataset written, student trained (loss ~2.04->2.16
over 2 toy steps), PEFT adapter saved. Tests 15/15 (2 new: prompt-set
parsing, JSONL round-trip); clippy -D warnings + rustfmt clean.
40 lines
1.2 KiB
TOML
40 lines
1.2 KiB
TOML
[package]
|
|
name = "hanzo-train"
|
|
readme = "../README.md"
|
|
authors = ["Hanzo AI <[email protected]>"]
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
rust-version.workspace = true
|
|
description = "Native Rust LoRA fine-tuning for the Hanzo engine, shaped like the Tinker API."
|
|
repository.workspace = true
|
|
keywords.workspace = true
|
|
categories.workspace = true
|
|
license.workspace = true
|
|
homepage.workspace = true
|
|
|
|
[dependencies]
|
|
hanzo-ml.workspace = true
|
|
hanzo-nn.workspace = true
|
|
|
|
anyhow.workspace = true
|
|
thiserror.workspace = true
|
|
tracing.workspace = true
|
|
serde = { workspace = true, features = ["derive"] }
|
|
serde_json.workspace = true
|
|
safetensors.workspace = true
|
|
# onig explicit: the workspace tokenizers dep is default-features=false, and a
|
|
# standalone `cargo build -p hanzo-train` doesn't inherit a regex backend via
|
|
# feature unification, so enable one here (matches the workspace's onig choice).
|
|
tokenizers = { workspace = true, features = ["onig"] }
|
|
hf-hub.workspace = true
|
|
rand.workspace = true
|
|
utoipa = { workspace = true, optional = true }
|
|
|
|
[dev-dependencies]
|
|
tempfile.workspace = true
|
|
|
|
[features]
|
|
cuda = ["hanzo-ml/cuda", "hanzo-nn/cuda"]
|
|
metal = ["hanzo-ml/metal", "hanzo-nn/metal"]
|
|
utoipa = ["dep:utoipa"]
|