File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,44 @@ uv run python training/train.py
5757- ` ./smollm-student-extractor/ ` (Hugging Face model/tokenizer)
5858- ` ./smollm-student-gguf/ ` (GGUF export for Ollama)
5959
60+ ## Ollama Modelfile
61+
62+ Create a ` Modelfile ` with the following content:
63+
64+ ``` text
65+ FROM hf.co/nimendraai/SmolLM2-360M-Assignment-Metadata-Extractor:Q4_K_M
66+
67+ # Apply the strict instruction template used during training
68+ TEMPLATE """### Instruction:
69+ Extract student info as JSON from the following text.
70+
71+ ### Input:
72+ {{ .Prompt }}
73+
74+ ### Response:
75+ """
76+
77+ # Set the System constraints
78+ SYSTEM """
79+ You are a precise student assignment data extractor.
80+ Output ONLY a valid JSON object. No explanation. No extra text. No markdown.
81+ Always output exactly: {"student_number":"...","student_name":"...","assignment_number":"..."}
82+ """
83+
84+ # Turn off creativity
85+ PARAMETER temperature 0
86+
87+ # Stop generating once the JSON is closed
88+ PARAMETER stop "}"
89+ ```
90+
91+ Build and run with Ollama:
92+
93+ ``` bash
94+ ollama create assignment-metadata-extractor -f Modelfile
95+ ollama run assignment-metadata-extractor
96+ ```
97+
6098## Dataset format
6199
62100` data/generate_dataset.py ` creates a JSON list where each item contains:
You can’t perform that action at this time.
0 commit comments