Kunal7370944861 commited on
Commit
06438bc
·
verified ·
1 Parent(s): 960f473
Files changed (1) hide show
  1. README.md +168 -49
README.md CHANGED
@@ -10,18 +10,21 @@ tags:
10
  pipeline_tag: text-generation
11
  ---
12
 
13
- # 🌟 Twinkel LLM - 72M (v0.1-alpha)
14
 
15
- **Experimental** 72M parameter language model by **Kunal Pandey**.
16
 
17
- ⚠️ **Status:** Early alpha - **CPU inference only**
18
 
19
- ## 🚀 Quick Start
 
 
20
 
21
  ```python
22
  from transformers import AutoTokenizer, AutoModelForCausalLM
23
  import torch
24
 
 
25
  tokenizer = AutoTokenizer.from_pretrained(
26
  "Kunal7370944861/Twinkel-LLM-72M",
27
  trust_remote_code=True
@@ -30,74 +33,190 @@ tokenizer = AutoTokenizer.from_pretrained(
30
  model = AutoModelForCausalLM.from_pretrained(
31
  "Kunal7370944861/Twinkel-LLM-72M",
32
  trust_remote_code=True,
33
- device_map="cpu" # CPU only for now
 
34
  )
35
 
36
- # Chat
37
- messages = [{"role": "user", "content": "Hello!"}]
38
- prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
39
- inputs = tokenizer(prompt, return_tensors="pt", return_token_type_ids=False)
40
- outputs = model.generate(**inputs, max_new_tokens=50)
41
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  ```
43
 
44
- ## ⚠️ Important Notes
 
 
 
 
 
 
 
45
 
46
- ### GPU Issues
47
- **GPU inference currently NOT working** due to CUDA compatibility issues.
 
 
48
 
49
- **Workaround:** Force CPU:
50
  ```python
51
- device_map="cpu"
 
 
 
 
52
  ```
53
 
54
- ### Known Limitations
55
- - ❌ GPU inference broken (fix in progress)
56
- - ❌ Only 72M parameters (small model)
57
- - ❌ May produce inconsistent responses
58
- - ❌ Experimental quality
59
- - ✅ Works on CPU
60
 
61
- ## 📋 Model Details
62
 
63
- - **Parameters:** 72M
64
- - **Architecture:** Custom transformer with GQA
65
- - **Context:** 512 tokens
66
- - **Creator:** Kunal Pandey
67
- - **Status:** Experimental alpha
68
- - **License:** Apache 2.0
69
 
70
- ## 🎯 Use Cases
 
 
 
 
 
71
 
72
- Educational/learning project
73
- ✅ Experimenting with small LLMs
74
- CPU inference testing
 
 
 
75
 
76
- Production use
77
- ❌ GPU inference (until fixed)
78
- ❌ Critical applications
79
 
80
- ## 🛠️ Training
81
 
82
- - Pre-trained on C4 dataset
83
- - Fine-tuned on instruction data
84
- - Hardware: Kaggle P100
85
- - Training steps: ~20K
86
 
87
- ## 🔮 Roadmap
 
 
 
 
88
 
89
- **v0.2 (planned):**
90
- - Fix GPU compatibility
91
- - Improve quality
92
- - Better responses
93
- - Longer context
94
 
95
  ## 📧 Contact
96
 
97
- Model repository: [Kunal7370944861/Twinkel-LLM-72M](https://huggingface.co/Kunal7370944861/Twinkel-LLM-72M)
98
 
99
  ---
100
 
 
101
  **Created by:** Kunal Pandey
102
  **Version:** 0.1-alpha
103
- **Status:** 🚧 Experimental
 
10
  pipeline_tag: text-generation
11
  ---
12
 
13
+ # 🌟 Twinkel LLM - 72M Parameters (v0.1-alpha)
14
 
15
+ **Twinkel LLM** is an experimental 72M parameter language model created by **Kunal Pandey** as a learning project.
16
 
17
+ ⚠️ **Status:** Early experimental release (v0.1-alpha)
18
 
19
+ ## 🚀 Quick Start (CPU Inference)
20
+
21
+ **⚠️ Important:** This model currently works best on **CPU**. GPU inference has known issues that are being resolved in future versions.
22
 
23
  ```python
24
  from transformers import AutoTokenizer, AutoModelForCausalLM
25
  import torch
26
 
27
+ # Load model
28
  tokenizer = AutoTokenizer.from_pretrained(
29
  "Kunal7370944861/Twinkel-LLM-72M",
30
  trust_remote_code=True
 
33
  model = AutoModelForCausalLM.from_pretrained(
34
  "Kunal7370944861/Twinkel-LLM-72M",
35
  trust_remote_code=True,
36
+ torch_dtype=torch.float32,
37
+ device_map="cpu" # Force CPU for stability
38
  )
39
 
40
+ # Generate response
41
+ def chat(message):
42
+ messages = [{"role": "user", "content": message}]
43
+ prompt = tokenizer.apply_chat_template(
44
+ messages,
45
+ tokenize=False,
46
+ add_generation_prompt=True
47
+ )
48
+
49
+ inputs = tokenizer(
50
+ prompt,
51
+ return_tensors="pt",
52
+ return_token_type_ids=False # Important!
53
+ )
54
+
55
+ with torch.no_grad():
56
+ outputs = model.generate(
57
+ **inputs,
58
+ max_new_tokens=100,
59
+ temperature=0.7,
60
+ do_sample=True,
61
+ pad_token_id=tokenizer.eos_token_id
62
+ )
63
+
64
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
65
+
66
+ # Test
67
+ response = chat("What is Python?")
68
+ print(response)
69
+ ```
70
+
71
+ ## 📋 Model Details
72
+
73
+ - **Parameters:** 72M (72 million)
74
+ - **Architecture:** Custom decoder-only transformer
75
+ - Hidden size: 448
76
+ - Layers: 6
77
+ - Attention: Grouped Query Attention (GQA)
78
+ - FFN: SwiGLU activation
79
+ - Position encoding: RoPE
80
+ - **Context length:** 512 tokens
81
+ - **Tokenizer:** SmolLM3 tokenizer (128K vocab)
82
+ - **Training:** Pre-trained on C4 + instruction fine-tuning
83
+ - **Creator:** Kunal Pandey
84
+ - **License:** Apache 2.0
85
+
86
+ ## ⚠️ Known Limitations
87
+
88
+ 1. **GPU Inference Issues**
89
+ - Model currently has compatibility issues with GPU inference
90
+ - CUDA assert errors occur during GPU loading
91
+ - **Workaround:** Use CPU inference (as shown above)
92
+ - Fix is planned for v0.2
93
+
94
+ 2. **Model Size**
95
+ - Only 72M parameters (much smaller than production models)
96
+ - Limited knowledge and reasoning capabilities
97
+ - May produce inconsistent or incorrect responses
98
+
99
+ 3. **Context Window**
100
+ - Limited to 512 tokens
101
+ - Cannot handle long conversations or documents
102
+
103
+ 4. **Response Quality**
104
+ - Experimental model, responses may be:
105
+ - Off-topic or irrelevant
106
+ - Repetitive
107
+ - Factually incorrect
108
+ - Not suitable for production use
109
+
110
+ 5. **Language**
111
+ - Primarily English
112
+ - Limited multilingual support
113
+
114
+ ## 🎯 Intended Use
115
+
116
+ This is an **experimental educational project** suitable for:
117
+
118
+ ✅ Learning about LLM architecture
119
+ ✅ Understanding model training and fine-tuning
120
+ ✅ Experimenting with small language models
121
+ ✅ CPU-based inference testing
122
+
123
+ ❌ **NOT suitable for:**
124
+ - Production applications
125
+ - Critical or safety-sensitive tasks
126
+ - High-quality text generation
127
+ - GPU-accelerated inference (until v0.2)
128
+
129
+ ## 🛠️ Training Details
130
+
131
+ ### Pre-training
132
+ - Dataset: C4 (English)
133
+ - Steps: 20,000
134
+ - Batch size: 32 (effective)
135
+ - Hardware: Kaggle P100 GPU
136
+ - Optimization: AdamW with mixed precision
137
+
138
+ ### Fine-tuning
139
+ - Dataset: Custom instruction dataset (~70K samples)
140
+ - Epochs: 2-3
141
+ - Learning rate: 1e-4
142
+ - Hardware: Kaggle P100 GPU
143
+
144
+ ## 🐛 Troubleshooting
145
+
146
+ ### GPU CUDA Error
147
+ ```
148
+ AcceleratorError: CUDA error: device-side assert triggered
149
  ```
150
 
151
+ **Solution:** Force CPU inference:
152
+ ```python
153
+ model = AutoModelForCausalLM.from_pretrained(
154
+ "Kunal7370944861/Twinkel-LLM-72M",
155
+ trust_remote_code=True,
156
+ device_map="cpu" # Add this
157
+ )
158
+ ```
159
 
160
+ ### token_type_ids Error
161
+ ```
162
+ ValueError: The following `model_kwargs` are not used: ['token_type_ids']
163
+ ```
164
 
165
+ **Solution:** Disable token_type_ids:
166
  ```python
167
+ inputs = tokenizer(
168
+ prompt,
169
+ return_tensors="pt",
170
+ return_token_type_ids=False # Add this
171
+ )
172
  ```
173
 
174
+ ## 📊 Performance
 
 
 
 
 
175
 
176
+ This is an experimental model with limited capabilities:
177
 
178
+ - **Size:** 72M parameters (vs billions in production models)
179
+ - **Quality:** Basic responses, may be off-topic
180
+ - **Speed (CPU):** ~5-10 tokens/second on standard CPU
181
+ - **Reliability:** Experimental, expect issues
182
+
183
+ ## 🔮 Future Plans
184
 
185
+ **Version 0.2 (Planned):**
186
+ - ✅ Fix GPU compatibility issues
187
+ - ✅ Improve response quality
188
+ - ✅ Add proper identity training
189
+ - ✅ Increase context length
190
+ - ✅ Better instruction following
191
 
192
+ ## 🙏 Acknowledgments
193
+
194
+ - **Creator:** Kunal Pandey
195
+ - **Tokenizer:** Based on SmolLM3 (Hugging Face)
196
+ - **Training data:** C4 dataset (AllenAI)
197
+ - **Inspiration:** SmolLM project
198
 
199
+ ## 📜 License
 
 
200
 
201
+ Apache 2.0 - Free for commercial and research use.
202
 
203
+ ## ⚠️ Disclaimer
 
 
 
204
 
205
+ This is an **experimental educational project**. The model:
206
+ - May produce incorrect, biased, or inappropriate content
207
+ - Has not been safety-tested or aligned
208
+ - Should not be used in production environments
209
+ - Is provided "as-is" without warranties
210
 
211
+ Use at your own risk for experimental and educational purposes only.
 
 
 
 
212
 
213
  ## 📧 Contact
214
 
215
+ For questions, issues, or feedback, please open an issue on the model repository.
216
 
217
  ---
218
 
219
+ **Model Status:** 🚧 Experimental Alpha
220
  **Created by:** Kunal Pandey
221
  **Version:** 0.1-alpha
222
+ **Last updated:** January 2026