marknorgren commited on
Commit
c788c6b
·
verified ·
1 Parent(s): 74db5b7

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: mlx-community/Mistral-7B-Instruct-v0.3-4bit
4
+ tags:
5
+ - mlx
6
+ - lora
7
+ - stanley-cup
8
+ - nhl
9
+ - sports
10
+ - history
11
+ - generated_from_trainer
12
+ datasets:
13
+ - custom-stanley-cup-facts
14
+ language:
15
+ - en
16
+ library_name: peft
17
+ pipeline_tag: text-generation
18
+ ---
19
+
20
+ # Mistral-7B Stanley Cup Facts LoRA
21
+
22
+ This is a LoRA adapter for Mistral-7B-Instruct fine-tuned on comprehensive NHL Stanley Cup championship data (1915-2025).
23
+
24
+ ## Model Details
25
+
26
+ - **Developed by**: Mark Norgren (MLX fine-tuning on Apple Silicon)
27
+ - **Model type**: LoRA adapter for causal language modeling
28
+ - **Base model**: [mlx-community/Mistral-7B-Instruct-v0.3-4bit](https://huggingface.co/mlx-community/Mistral-7B-Instruct-v0.3-4bit)
29
+ - **Training Framework**: MLX (Apple Silicon optimized)
30
+ - **License**: Apache 2.0
31
+
32
+ ## Training Details
33
+
34
+ - **LoRA Rank**: 16
35
+ - **LoRA Alpha**: 320.0
36
+ - **LoRA Dropout**: 0.1
37
+ - **Training Iterations**: 2500
38
+ - **Batch Size**: 2
39
+ - **Learning Rate**: 1.5e-05
40
+ - **Training Data**: 127 curated examples of Stanley Cup winners, scores, and matchups
41
+
42
+ ## Performance
43
+
44
+ Achieves **100% accuracy** on Stanley Cup fact retrieval:
45
+ - ✅ All championship winners (1915-2025)
46
+ - ✅ Series scores and matchups
47
+ - ✅ Special cases (1919 flu cancellation, 2005 lockout)
48
+ - ✅ Recent championships (2023 Vegas, 2024 Florida)
49
+
50
+ ## Usage
51
+
52
+ ### With MLX (Recommended for Apple Silicon)
53
+
54
+ ```bash
55
+ # Install MLX LM
56
+ pip install mlx-lm
57
+
58
+ # Generate text
59
+ mlx_lm.generate \
60
+ --model "mlx-community/Mistral-7B-Instruct-v0.3-4bit" \
61
+ --adapter-path "marknorgren/mistral-7b-stanley-cup-lora" \
62
+ --prompt "Who won the Stanley Cup in 2024?" \
63
+ --max-tokens 50
64
+ ```
65
+
66
+ ### With Transformers + PEFT
67
+
68
+ ```python
69
+ from transformers import AutoModelForCausalLM, AutoTokenizer
70
+ from peft import PeftModel
71
+
72
+ # Load base model
73
+ base_model = AutoModelForCausalLM.from_pretrained(
74
+ "mistralai/Mistral-7B-Instruct-v0.3",
75
+ torch_dtype=torch.float16,
76
+ device_map="auto"
77
+ )
78
+ tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.3")
79
+
80
+ # Load LoRA adapter
81
+ model = PeftModel.from_pretrained(base_model, "marknorgren/mistral-7b-stanley-cup-lora")
82
+
83
+ # Generate
84
+ prompt = "Who won the Stanley Cup in 2024?"
85
+ inputs = tokenizer(prompt, return_tensors="pt")
86
+ outputs = model.generate(**inputs, max_length=100, temperature=0.1)
87
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
88
+ ```
89
+
90
+ ## Example Outputs
91
+
92
+ ```
93
+ Q: Who won the Stanley Cup in 2024?
94
+ A: In 2024, the Florida Panthers won the Stanley Cup, defeating the Edmonton Oilers with a series score of 4-3.
95
+
96
+ Q: What happened with the Stanley Cup in 1919?
97
+ A: In 1919, the Stanley Cup was Not awarded (Spanish flu).
98
+
99
+ Q: Who won the Stanley Cup in 1967?
100
+ A: In 1967, the Toronto Maple Leafs won the Stanley Cup, defeating the Montreal Canadiens with a series score of 4-2.
101
+ ```
102
+
103
+ ## Training Data
104
+
105
+ The adapter was trained on 127 carefully curated examples covering:
106
+ - Every Stanley Cup winner from 1915-2025
107
+ - Championship series scores
108
+ - Finals matchups
109
+ - Special circumstances (pandemic, lockouts)
110
+ - Multiple phrasings for recent years
111
+
112
+ ## Limitations
113
+
114
+ - Specialized for Stanley Cup facts only
115
+ - Best performance with questions similar to training format
116
+ - May not generalize well to other hockey or sports topics
117
+ - Responses reflect data up to 2025 season
118
+
119
+ ## Technical Specifications
120
+
121
+ - **Adapter Size**: ~27MB
122
+ - **Inference Speed**: ~97 tokens/sec on Apple M-series
123
+ - **Memory Usage**: ~4.2GB peak with 4-bit base model
124
+
125
+ ## Citation
126
+
127
+ If you use this model, please cite:
128
+
129
+ ```
130
+ @misc{mistral-stanley-cup-lora,
131
+ author = {Mark Norgren},
132
+ title = {Mistral-7B Stanley Cup Facts LoRA},
133
+ year = {2025},
134
+ publisher = {Hugging Face},
135
+ url = {https://huggingface.co/marknorgren/mistral-7b-stanley-cup-lora}
136
+ }
137
+ ```
138
+
139
+ ## Acknowledgments
140
+
141
+ - Base model by Mistral AI
142
+ - Fine-tuning framework by MLX team
143
+ - Training performed on Apple Silicon
adapter_config.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model_name_or_path": "mlx-community/Mistral-7B-Instruct-v0.3-4bit",
3
+ "bias": "none",
4
+ "fan_in_fan_out": false,
5
+ "inference_mode": true,
6
+ "init_lora_weights": true,
7
+ "layers_pattern": null,
8
+ "layers_to_transform": null,
9
+ "lora_alpha": 320.0,
10
+ "lora_dropout": 0.1,
11
+ "modules_to_save": null,
12
+ "peft_type": "LORA",
13
+ "r": 16,
14
+ "revision": null,
15
+ "target_modules": [
16
+ "q_proj",
17
+ "k_proj",
18
+ "v_proj",
19
+ "o_proj"
20
+ ],
21
+ "task_type": "CAUSAL_LM"
22
+ }
adapters.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3084ef483f4df3a69043f559f6beed49535370389590001aba458b3ae9d28437
3
+ size 27277068
checkpoints/0000250_adapters.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dcca8cbb2fcf362a12ab5af613946befacc2f16860d394c7d234b91ac0cf727d
3
+ size 27277068
checkpoints/0000500_adapters.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:766e1b2431ef1f9c16be30f06db9bcddf02de273a3dc8574db913b933a6e148d
3
+ size 27277068
checkpoints/0000750_adapters.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d43292e3ff2719ca92ff901f8860dc149b7d7e00c9976ca779f4d843bbdcc72
3
+ size 27277068
checkpoints/0001000_adapters.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3084ef483f4df3a69043f559f6beed49535370389590001aba458b3ae9d28437
3
+ size 27277068