stage-3d: cockpit /train page — datasets + adapters + training metadata
New /train route lists built JSONL datasets (examples, size) and trained adapters with their base model, hyperparameters, dataset provenance, and loss history. train_qlora.py now records train_loss + per-step loss_history into training_meta.json so future runs surface a loss curve in the cockpit. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -114,12 +114,18 @@ def main() -> None:
|
||||
report_to="none",
|
||||
),
|
||||
)
|
||||
trainer.train()
|
||||
train_result = trainer.train()
|
||||
|
||||
final_dir = output_dir / "final"
|
||||
final_dir.mkdir(parents=True, exist_ok=True)
|
||||
model.save_pretrained(str(final_dir))
|
||||
tokenizer.save_pretrained(str(final_dir))
|
||||
|
||||
loss_history = [
|
||||
{"step": h["step"], "loss": h["loss"], "epoch": h.get("epoch")}
|
||||
for h in trainer.state.log_history
|
||||
if "loss" in h
|
||||
]
|
||||
(output_dir / "training_meta.json").write_text(json.dumps({
|
||||
"base_model": args.base_model,
|
||||
"lora_r": args.lora_r,
|
||||
@@ -129,6 +135,8 @@ def main() -> None:
|
||||
"datasets": [str(p) for p in paths],
|
||||
"examples": len(examples),
|
||||
"seed": args.seed,
|
||||
"train_loss": train_result.training_loss,
|
||||
"loss_history": loss_history,
|
||||
}, indent=2))
|
||||
print(f"[psyc-train] adapter saved → {final_dir}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user