Commit
·
5fe8f45
1
Parent(s):
64e2ee8
Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,204 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
-
|
10 |
|
|
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
-
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
-
|
33 |
-
-
|
34 |
-
-
|
|
|
|
|
|
|
35 |
|
36 |
## Uses
|
37 |
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
### Direct Use
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
|
52 |
### Out-of-Scope Use
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
-
|
70 |
-
## How to Get Started with the Model
|
71 |
-
|
72 |
-
Use the code below to get started with the model.
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
|
76 |
## Training Details
|
77 |
|
78 |
### Training Data
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
|
84 |
### Training Procedure
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
|
93 |
-
|
|
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
|
|
|
|
102 |
|
103 |
## Evaluation
|
104 |
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
### Testing Data, Factors & Metrics
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
|
121 |
#### Metrics
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
|
127 |
### Results
|
128 |
|
129 |
-
|
130 |
|
131 |
-
|
132 |
|
|
|
133 |
|
|
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
|
145 |
-
|
146 |
|
147 |
-
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
### Model Architecture and Objective
|
156 |
|
157 |
-
|
158 |
|
159 |
-
|
|
|
|
|
160 |
|
161 |
-
|
162 |
|
163 |
#### Hardware
|
164 |
|
165 |
-
|
166 |
|
167 |
#### Software
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
|
191 |
-
|
|
|
|
|
192 |
|
193 |
-
## Model Card Authors
|
194 |
|
195 |
-
|
196 |
|
197 |
## Model Card Contact
|
198 |
|
199 |
-
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
license: mit
|
4 |
+
datasets:
|
5 |
+
- SciPhi/textbooks-are-all-you-need-lite
|
6 |
+
- nampdn-ai/tiny-textbooks
|
7 |
+
- nampdn-ai/tiny-strange-textbooks
|
8 |
+
- nampdn-ai/tiny-codes
|
9 |
+
- nampdn-ai/tiny-math-textbooks
|
10 |
+
- nampdn-ai/tiny-webtext
|
11 |
+
- nampdn-ai/tiny-orca-textbooks
|
12 |
+
- nampdn-ai/tiny-lessons
|
13 |
+
- roneneldan/TinyStories
|
14 |
+
- ajibawa-2023/Children-Stories-Collection
|
15 |
+
- ajibawa-2023/General-Stories-Collection
|
16 |
+
- kerinin/hackernews-stories
|
17 |
+
- lucadiliello/wikipedia_512_pretraining
|
18 |
+
- Salesforce/wikitext
|
19 |
+
- ChristophSchuhmann/basic-math-problems-with-step-by-step-solutions
|
20 |
+
- iamtarun/python_code_instructions_18k_alpaca
|
21 |
+
- prithivMLmods/Step-Instruction-Gx
|
22 |
+
- LinhDuong/chatdoctor-200k
|
23 |
+
- MBZUAI/LaMini-instruction
|
24 |
+
- qwedsacf/grade-school-math-instructions
|
25 |
+
- TigerResearch/tigerbot-stackexchange-qa-en-0.5m
|
26 |
+
language:
|
27 |
+
- en
|
28 |
---
|
29 |
|
30 |
+
# amusktweewt/tiny-model-500M-chat-v2
|
|
|
|
|
|
|
31 |
|
32 |
+
This model is a general-purpose transformer-based language model designed for tasks such as text generation, story writing, and conversational interactions. It leverages multiple curated datasets to enhance its storytelling, coding, and question-answering capabilities. This project is intended for academic research and educational purposes only. It is designed for experimentation, learning, and development of language-based AI systems.
|
33 |
|
34 |
## Model Details
|
35 |
|
36 |
### Model Description
|
37 |
|
38 |
+
The model was developed with a focus on balancing performance and computational efficiency. It employs **flash attention** and other optimizations to improve memory efficiency and speed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
- **Developed by:** amusktweewt
|
41 |
+
- **Model type:** LlamaForCausalLM
|
42 |
+
- **Architectural Details:**
|
43 |
+
- 12 layers
|
44 |
+
- 16 attention heads
|
45 |
+
- Hidden size: 1536
|
46 |
+
- Flash attention 2 enabled
|
47 |
+
- Dynamic RoPE scaling
|
48 |
+
- **License:** MIT
|
49 |
+
- **Language(s) (NLP):** English
|
50 |
|
51 |
## Uses
|
52 |
|
|
|
|
|
53 |
### Direct Use
|
54 |
|
55 |
+
This model is intended for text generation, code completion, chat-based applications, and story writing.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
### Out-of-Scope Use
|
58 |
|
59 |
+
- Tasks requiring high factual accuracy
|
60 |
+
- Math or thinking related tasks
|
61 |
+
- Applications involving sensitive content without human review
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
## Training Details
|
64 |
|
65 |
### Training Data
|
66 |
|
67 |
+
The model was trained on a diverse collection of datasets, including:
|
68 |
|
69 |
+
- Textbooks and academic content
|
70 |
+
- Creative and children's stories
|
71 |
+
- Coding instruction datasets
|
72 |
+
- Wiki-based texts and general stories
|
73 |
+
- Mathematics and step-by-step solutions
|
74 |
|
75 |
### Training Procedure
|
76 |
|
77 |
+
#### Preprocessing
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
+
- Custom BPE tokenizer with a vocabulary size of 32,768
|
80 |
+
- Applied dynamic RoPE scaling for better long-context handling
|
81 |
|
82 |
+
#### Hyperparameters
|
83 |
|
84 |
+
- **Batch size:** 12 (per device)
|
85 |
+
- **Gradient accumulation:** 2 steps
|
86 |
+
- **Learning rate:** 1e-5
|
87 |
+
- **Weight decay:** 0.002
|
88 |
+
- **Warmup ratio:** 10%
|
89 |
+
- **Precision:** FP16 (mixed precision)
|
90 |
|
91 |
+
#### Training Setup
|
92 |
|
93 |
+
- **Hardware:** NVIDIA 4090 GPU
|
94 |
+
- **Training Time:** 216 hours
|
95 |
+
- **Dataset Size** 69 GB of Text
|
96 |
|
97 |
## Evaluation
|
98 |
|
|
|
|
|
99 |
### Testing Data, Factors & Metrics
|
100 |
|
101 |
+
The model was evaluated using subsets of the training data, focusing on language coherence, relevancy, and fluency.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
#### Metrics
|
104 |
|
105 |
+
- **Loss:** Evaluated based on token-level prediction accuracy.
|
106 |
+
- **Perplexity:** 2.506
|
|
|
107 |
|
108 |
### Results
|
109 |
|
110 |
+
The model generates coherent and most of the time contextually appropriate outputs across multiple domains.
|
111 |
|
112 |
+
## Risks and Limitations
|
113 |
|
114 |
+
### Known Issues
|
115 |
|
116 |
+
- The model may produce outputs reflecting biases present in the training data.
|
117 |
|
118 |
+
### Recommendations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
|
120 |
+
Users should apply human review when using the model in critical or sensitive applications.
|
121 |
|
122 |
+
## How to Get Started with the Model
|
|
|
|
|
|
|
|
|
123 |
|
124 |
+
```python
|
125 |
+
import torch
|
126 |
+
from transformers import pipeline, set_seed
|
127 |
+
|
128 |
+
model_name = "amusktweewt/tiny-model-500M-chat-v2"
|
129 |
+
chatbot = pipeline(
|
130 |
+
"text-generation",
|
131 |
+
model=model_name,
|
132 |
+
device=0
|
133 |
+
)
|
134 |
+
|
135 |
+
set_seed(42)
|
136 |
+
|
137 |
+
print("Chatbot is ready! Type 'exit' to end the conversation.")
|
138 |
+
|
139 |
+
while True:
|
140 |
+
user_input = input("You: ").strip()
|
141 |
+
if user_input.lower() == "exit":
|
142 |
+
print("Exiting chat. Goodbye!")
|
143 |
+
break
|
144 |
+
|
145 |
+
messages = [
|
146 |
+
{"role": "user", "content": user_input},
|
147 |
+
{"role": "assistant", "content": ""}
|
148 |
+
]
|
149 |
+
|
150 |
+
prompt = chatbot.tokenizer.apply_chat_template(messages, tokenize=False)
|
151 |
+
|
152 |
+
# Generate text using the formatted prompt.
|
153 |
+
response = chatbot(
|
154 |
+
prompt,
|
155 |
+
do_sample=True,
|
156 |
+
max_new_tokens=512,
|
157 |
+
top_k=50,
|
158 |
+
temperature=0.1,
|
159 |
+
num_return_sequences=1,
|
160 |
+
repetition_penalty=1.1,
|
161 |
+
pad_token_id=chatbot.tokenizer.eos_token_id,
|
162 |
+
min_new_tokens=0
|
163 |
+
)
|
164 |
+
|
165 |
+
full_text = response[0]["generated_text"]
|
166 |
+
bot_response = full_text[len(prompt):].strip()
|
167 |
+
print(f"Bot: {bot_response}")
|
168 |
+
```
|
169 |
+
|
170 |
+
## Technical Specifications
|
171 |
|
172 |
### Model Architecture and Objective
|
173 |
|
174 |
+
The model follows a **Transformer-based architecture** optimized for causal language modeling tasks.
|
175 |
|
176 |
+
- Attention heads: 16
|
177 |
+
- Hidden size: 1536
|
178 |
+
- Flash attention and memory-efficient attention enabled
|
179 |
|
180 |
+
### Compute Infrastructure
|
181 |
|
182 |
#### Hardware
|
183 |
|
184 |
+
- Single GPU (NVIDIA 4090)
|
185 |
|
186 |
#### Software
|
187 |
|
188 |
+
- Python 3.8+
|
189 |
+
- HuggingFace Transformers 4.48.0
|
190 |
+
- PyTorch 2.4
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
+
## Environmental Impact
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
+
- **Training Hours:** 216 hours
|
195 |
+
- **Hardware:** NVIDIA 4090
|
196 |
+
- **Carbon Emitted:** 9.07 kg CO2 eq
|
197 |
|
198 |
+
## Model Card Authors
|
199 |
|
200 |
+
amusktweewt
|
201 |
|
202 |
## Model Card Contact
|
203 |
|
204 |
+
For questions or feedback, contact amusktweewt.
|