toddric_v2_merged/
├─ config.json
├─ generation_config.json
├─ tokenizer_config.json
├─ tokenizer.json (or tokenizer.model)
├─ model.safetensors (or shards model-00001-of-0000N.safetensors)
└─ README.md
1from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
2
3model_dir = "toddie314/toddric_v2_merged" # or local path
4
5bnb = BitsAndBytesConfig(load_in_4bit=True)
6tok = AutoTokenizer.from_pretrained(model_dir, use_fast=True)
7model = AutoModelForCausalLM.from_pretrained(
8 model_dir,
9 quantization_config=bnb,
10 device_map="auto",
11)
12
13system = "You are toddric: crisp, witty, encouraging. Prefer concrete advice over fluff."
14user = "Give three tactics to make technical docs clearer."
15
16messages = [
17 {"role":"system","content":system},
18 {"role":"user","content":user},
19]
20
21prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
22inputs = tok(prompt, return_tensors="pt").to(model.device)
23
24out = model.generate(
25 **inputs,
26 max_new_tokens=200,
27 do_sample=True,
28 temperature=0.3,
29 top_p=0.9,
30 repetition_penalty=1.12,
31)
32print(tok.decode(out[0], skip_special_tokens=True))
33Greedy “format-strict” tasks often work best with:
34
35python
36Copy code
37do_sample=False, max_new_tokens=64
38bf16/fp16 (server inference)
39Use vLLM/TGI with 24–32 GB+ VRAM for maximum throughput. Quant support varies by version.
40
41Why “merged”?
42No PEFT adapters at runtime.
43
44Simpler deployment (vLLM/TGI/Transformers).
45
46One folder, one artifact.
47
48To re-merge future adapters, call peft_model.merge_and_unload() or a helper like merge_lora.py.
49
50Prompting patterns (baked-in habits)
51Two-line strict style drill
52
53pgsql
54Copy code
55Return EXACTLY a fenced code block with two lines.
56Line 1 must begin with 'Tone:' and give a short tip (<=12 words).
57Line 2 must begin with 'Style:' and give a short tip (<=12 words).
58Use plain text. Include 'narrative', 'voice', and 'prose' across the two lines.
59No extra text before/after.
60Safety refusal (medical dosing)
61Brief refusal + helpful redirect (doctor/urgent care/emergency line). No first-person, no apologies, 2–4 sentences.
62
63JSON-only tool output
64Output exactly one JSON object. No prose/markdown/questions.
65
66Hardware & env notes
674-bit runs on ~16 GB consumer GPUs with device_map="auto".
68
69Set PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to reduce fragmentation.
70
71For CPU fallback, load with low_cpu_mem_usage=True (slower, but fine for tests).
72
73Eval snapshot
74Style Meter (greedy): passes strict tasks (RAG vs fine-tuning, dosing refusal, two-line truth/misconception, JSON-only SQL gating).
75
76Stratified Eval: sane length distribution; no runaway outputs.
77
78These are smoke tests—bring your own eval for production.
79
80Limitations & safety
81Not a medical/legal/financial advisor; should refuse dosing and high-risk instructions and redirect responsibly.
82
83Concise by design; ask explicitly for longer explanations or examples.
84
85License
86Base: Meta Llama 3.1 license.
87
88This fine-tuned merged artifact: inherits the base license unless you specify otherwise.
89
90Citation
91bash
92Copy code
93@software{toddric_v2_merged_2025,
94 title = {toddric_v2_merged: a crisp, concrete-advice Llama-3.1-8B},
95 author = {toddie314},
96 year = {2025},
97 url = {https://huggingface.co/toddie314/toddric_v2_merged}
98}
99Changelog
100v2 (Stage-C merged): DPO merge; strict formatting stabilized; JSON gating improved.
101
102v1: Base + SFT + refinement adapters (pre-merge).
103