ewre324 commited on
Commit
5333c1f
·
verified ·
1 Parent(s): a86b69f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +98 -3
README.md CHANGED
@@ -1,3 +1,98 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ language:
5
+ - en
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - safetensors
9
+ - onnx
10
+ - transformers.js
11
+ base_model:
12
+ - HuggingFaceTB/SmolLM2-135M
13
+ ---
14
+ This model has been trained on human generated, AI Reasoned questions and answers https://huggingface.co/datasets/KingNish/reasoning-base-20k .
15
+ # Uploaded model
16
+
17
+ - **Developed by:** ewre324
18
+ - **License:** apache-2.0
19
+ - **Finetuned from model :** HuggingFaceTB/SmolLM2-135M-Instruct
20
+
21
+ # SmolLM2-Reasoning
22
+
23
+ ## Table of Contents
24
+
25
+ 1. [Model Summary](##model-summary)
26
+ 2. [Limitations](##limitations)
27
+ 3. [Training](##training)
28
+ 4. [License](##license)
29
+ 5. [Citation](##citation)
30
+
31
+ ## Model Summary
32
+
33
+ SmolLM2 is a family of compact language models available in three size: 135M, 360M, and 1.7B parameters. They are capable of solving a wide range of tasks while being lightweight enough to run on-device.
34
+
35
+ SmolLM2 demonstrates significant advances over its predecessor SmolLM1, particularly in instruction following, knowledge, reasoning. The 135M model was trained on 2 trillion tokens using a diverse dataset combination: FineWeb-Edu, DCLM, The Stack, along with new filtered datasets we curated and will release soon. We developed the instruct version through supervised fine-tuning (SFT) using a combination of public datasets and our own curated datasets. We then applied Direct Preference Optimization (DPO) using [UltraFeedback](https://huggingface.co/datasets/HuggingFaceH4/ultrafeedback_binarized).
36
+
37
+ The instruct model additionally supports tasks such as text rewriting, summarization and function calling (for the 1.7B) thanks to datasets developed by [Argilla](https://huggingface.co/argilla) such as [Synth-APIGen-v0.1](https://huggingface.co/datasets/argilla/Synth-APIGen-v0.1).
38
+ You can find the SFT dataset here: https://huggingface.co/datasets/HuggingFaceTB/smol-smoltalk and finetuning code at https://github.com/huggingface/alignment-handbook/tree/main/recipes/smollm2
39
+
40
+ ### How to use
41
+
42
+ ### Transformers
43
+ ```bash
44
+ pip install transformers
45
+ ```
46
+
47
+ ```python
48
+ from transformers import AutoModelForCausalLM, AutoTokenizer
49
+ checkpoint = "HuggingFaceTB/SmolLM2-135M-Instruct"
50
+
51
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
52
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
53
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
54
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
55
+
56
+ messages = [{"role": "user", "content": "What is gravity?"}]
57
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
58
+ print(input_text)
59
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
60
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
61
+ print(tokenizer.decode(outputs[0]))
62
+ ```
63
+
64
+ ### Chat in TRL
65
+ You can also use the TRL CLI to chat with the model from the terminal:
66
+ ```bash
67
+ pip install trl
68
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM2-135M-Instruct --device cpu
69
+ ```
70
+
71
+ ## Evaluation
72
+ TODO
73
+
74
+
75
+
76
+ ## Limitations
77
+
78
+ SmolLM2 models primarily understand and generate content in English. They can produce text on a variety of topics, but the generated content may not always be factually accurate, logically consistent, or free from biases present in the training data. These models should be used as assistive tools rather than definitive sources of information. Users should always verify important information and critically evaluate any generated content.
79
+
80
+ ## Training
81
+
82
+ ### Model
83
+
84
+ - **Architecture:** Transformer decoder
85
+ - **Pretraining tokens:** 2T
86
+ - **Precision:** bfloat16
87
+
88
+ ### Hardware
89
+
90
+ - **GPUs:** 2 A100
91
+
92
+ ### Software
93
+
94
+ - **Training Framework:** [nanotron](https://github.com/huggingface/nanotron/tree/main)
95
+
96
+ ## License
97
+
98
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)