"""Generate model-card samples from the PSSA-300M export. Usage on the box: cd /marimo/pssa_300m && python3 samples_300m.py artifacts/export \ artifacts/samples_300m.json """ import json import sys import torch from pssa_model import from_pretrained, generate PROMPTS = [ ("code", "def train_step("), ("story", "Once upon a time"), ("web", "The history of"), ("math", "The derivative of"), ] def main(): export_dir, out_path = sys.argv[1], sys.argv[2] device = "cuda" if torch.cuda.is_available() else "cpu" model, tok = from_pretrained(export_dir, device=device) out = {} for name, prompt in PROMPTS: torch.manual_seed(1234) text = generate(model, tok, prompt, max_new=110, temp=0.7, top_k=40, device=device) out[name] = text print(f"--- {name} ---\n{text}\n", flush=True) with open(out_path, "w") as f: json.dump(out, f, indent=1) print("wrote", out_path, flush=True) if __name__ == "__main__": main()