Hjgugugjhuhjggg commited on
Commit
85253d7
·
verified ·
1 Parent(s): 4732acc

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +135 -0
  3. smollm2-135m-instruct.bf16.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ smollm2-135m-instruct.bf16.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ - autoquant
12
+ - gguf
13
+ base_model:
14
+ - HuggingFaceTB/SmolLM2-135M
15
+ ---
16
+
17
+
18
+ # SmolLM2
19
+
20
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/3ntM63zkmxY2cNRhgY_Kl.png)
21
+
22
+ ## Table of Contents
23
+
24
+ 1. [Model Summary](##model-summary)
25
+ 2. [Limitations](##limitations)
26
+ 3. [Training](##training)
27
+ 4. [License](##license)
28
+ 5. [Citation](##citation)
29
+
30
+ ## Model Summary
31
+
32
+ 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.
33
+
34
+ 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).
35
+
36
+ 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).
37
+ 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
38
+
39
+ ### How to use
40
+
41
+ ### Transformers
42
+ ```bash
43
+ pip install transformers
44
+ ```
45
+
46
+ ```python
47
+ from transformers import AutoModelForCausalLM, AutoTokenizer
48
+ checkpoint = "HuggingFaceTB/SmolLM2-135M-Instruct"
49
+
50
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
51
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
52
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
53
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
54
+
55
+ messages = [{"role": "user", "content": "What is gravity?"}]
56
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
57
+ print(input_text)
58
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
59
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
60
+ print(tokenizer.decode(outputs[0]))
61
+ ```
62
+
63
+ ### Chat in TRL
64
+ You can also use the TRL CLI to chat with the model from the terminal:
65
+ ```bash
66
+ pip install trl
67
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM2-135M-Instruct --device cpu
68
+ ```
69
+
70
+ ## Evaluation
71
+
72
+ In this section, we report the evaluation results of SmolLM2. All evaluations are zero-shot unless stated otherwise, and we use [lighteval](https://github.com/huggingface/lighteval) to run them.
73
+
74
+ ## Base pre-trained model
75
+
76
+ | Metrics | SmolLM2-135M-8k | SmolLM-135M |
77
+ |:-------------------|:----------------:|:------------:|
78
+ | HellaSwag | **42.1** | 41.2 |
79
+ | ARC (Average) | **43.9** | 42.4 |
80
+ | PIQA | 68.4 | 68.4 |
81
+ | MMLU (cloze) | **31.5** | 30.2 |
82
+ | CommonsenseQA | **33.9** | 32.7 |
83
+ | TriviaQA | 4.1 | **4.3** |
84
+ | Winogrande | 51.3 | 51.3 |
85
+ | OpenBookQA | **34.6** | 34.0 |
86
+ | GSM8K (5-shot) | **1.4** | 1.0 |
87
+
88
+
89
+ ## Instruction model
90
+
91
+ | Metric | SmolLM2-135M-Instruct | SmolLM-135M-Instruct |
92
+ |:-----------------------------|:---------------------:|:--------------------:|
93
+ | IFEval (Average prompt/inst) | **29.9** | 17.2 |
94
+ | MT-Bench | **19.8** | 16.8 |
95
+ | HellaSwag | **40.9** | 38.9 |
96
+ | ARC (Average) | **37.3** | 33.9 |
97
+ | PIQA | **66.3** | 64.0 |
98
+ | MMLU (cloze) | **29.3** | 28.3 |
99
+ | BBH (3-shot) | **28.2** | 25.2 |
100
+ | GSM8K (5-shot) | 1.4 | 1.4 |
101
+
102
+
103
+
104
+ ## Limitations
105
+
106
+ 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.
107
+
108
+ ## Training
109
+
110
+ ### Model
111
+
112
+ - **Architecture:** Transformer decoder
113
+ - **Pretraining tokens:** 2T
114
+ - **Precision:** bfloat16
115
+
116
+ ### Hardware
117
+
118
+ - **GPUs:** 64 H100
119
+
120
+ ### Software
121
+
122
+ - **Training Framework:** [nanotron](https://github.com/huggingface/nanotron/tree/main)
123
+
124
+ ## License
125
+
126
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
127
+
128
+ ## Citation
129
+ ```bash
130
+ @misc{allal2024SmolLM2,
131
+ title={SmolLM2 - with great data, comes great performance},
132
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Lewis Tunstall and Agustín Piqueres and Andres Marafioti and Cyril Zakka and Leandro von Werra and Thomas Wolf},
133
+ year={2024},
134
+ }
135
+ ```
smollm2-135m-instruct.bf16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b94c0154dfb4ab80cefb1e832fb6280b9e66ef651962fc81d9e2680bc897e177
3
+ size 270886272