Mungert commited on
Commit
76c73ad
·
verified ·
0 Parent(s):

Super-squash history to reclaim storage

Browse files
.gitattributes ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz 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-1.7B-Instruct-f16.gguf filter=lfs diff=lfs merge=lfs -text
37
+ SmolLM2-1.7B-Instruct-f16_q8_0.gguf filter=lfs diff=lfs merge=lfs -text
38
+ SmolLM2-1.7B-Instruct-bf16_q8_0.gguf filter=lfs diff=lfs merge=lfs -text
39
+ SmolLM2-1.7B-Instruct-f16_q6_k.gguf filter=lfs diff=lfs merge=lfs -text
40
+ SmolLM2-1.7B-Instruct-bf16_q6_k.gguf filter=lfs diff=lfs merge=lfs -text
41
+ SmolLM2-1.7B-Instruct-f16_q4_k.gguf filter=lfs diff=lfs merge=lfs -text
42
+ SmolLM2-1.7B-Instruct-bf16_q4_k.gguf filter=lfs diff=lfs merge=lfs -text
43
+ SmolLM2-1.7B-Instruct-q3_k_l.gguf filter=lfs diff=lfs merge=lfs -text
44
+ SmolLM2-1.7B-Instruct-q4_k_l.gguf filter=lfs diff=lfs merge=lfs -text
45
+ SmolLM2-1.7B-Instruct-q5_k_l.gguf filter=lfs diff=lfs merge=lfs -text
46
+ SmolLM2-1.7B-Instruct-q6_k_l.gguf filter=lfs diff=lfs merge=lfs -text
47
+ SmolLM2-1.7B-Instruct-q3_k_m.gguf filter=lfs diff=lfs merge=lfs -text
48
+ SmolLM2-1.7B-Instruct-q3_k_s.gguf filter=lfs diff=lfs merge=lfs -text
49
+ SmolLM2-1.7B-Instruct-q4_k_m.gguf filter=lfs diff=lfs merge=lfs -text
50
+ SmolLM2-1.7B-Instruct-q4_k_s.gguf filter=lfs diff=lfs merge=lfs -text
51
+ SmolLM2-1.7B-Instruct-q5_k_m.gguf filter=lfs diff=lfs merge=lfs -text
52
+ SmolLM2-1.7B-Instruct-q5_k_s.gguf filter=lfs diff=lfs merge=lfs -text
53
+ SmolLM2-1.7B-Instruct-q6_k_m.gguf filter=lfs diff=lfs merge=lfs -text
54
+ SmolLM2-1.7B-Instruct-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
55
+ SmolLM2-1.7B-Instruct-q4_0.gguf filter=lfs diff=lfs merge=lfs -text
56
+ SmolLM2-1.7B-Instruct-q4_1.gguf filter=lfs diff=lfs merge=lfs -text
57
+ SmolLM2-1.7B-Instruct-q4_0_l.gguf filter=lfs diff=lfs merge=lfs -text
58
+ SmolLM2-1.7B-Instruct-q4_1_l.gguf filter=lfs diff=lfs merge=lfs -text
59
+ SmolLM2-1.7B-Instruct-q5_0.gguf filter=lfs diff=lfs merge=lfs -text
60
+ SmolLM2-1.7B-Instruct-q5_1.gguf filter=lfs diff=lfs merge=lfs -text
61
+ SmolLM2-1.7B-Instruct-q5_0_l.gguf filter=lfs diff=lfs merge=lfs -text
62
+ SmolLM2-1.7B-Instruct-q5_1_l.gguf filter=lfs diff=lfs merge=lfs -text
63
+ SmolLM2-1.7B-Instruct-iq3_xs.gguf filter=lfs diff=lfs merge=lfs -text
64
+ SmolLM2-1.7B-Instruct-iq3_xxs.gguf filter=lfs diff=lfs merge=lfs -text
65
+ SmolLM2-1.7B-Instruct-iq3_s.gguf filter=lfs diff=lfs merge=lfs -text
66
+ SmolLM2-1.7B-Instruct-iq3_m.gguf filter=lfs diff=lfs merge=lfs -text
67
+ SmolLM2-1.7B-Instruct-iq4_xs.gguf filter=lfs diff=lfs merge=lfs -text
68
+ SmolLM2-1.7B-Instruct-iq4_nl.gguf filter=lfs diff=lfs merge=lfs -text
69
+ SmolLM2-1.7B-Instruct.imatrix filter=lfs diff=lfs merge=lfs -text
70
+ SmolLM2-1.7B-Instruct-bf16.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,420 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-1.7B
13
+ ---
14
+
15
+ # <span style="color: #7FFF7F;">SmolLM2-1.7B-Instruct GGUF Models</span>
16
+
17
+
18
+ ## <span style="color: #7F7FFF;">Model Generation Details</span>
19
+
20
+ This model was generated using [llama.cpp](https://github.com/ggerganov/llama.cpp) at commit [`1f63e75f`](https://github.com/ggerganov/llama.cpp/commit/1f63e75f3b5dc7f44dbe63c8a41d23958fe95bc0).
21
+
22
+
23
+
24
+
25
+
26
+
27
+ ---
28
+
29
+ <a href="https://readyforquantum.com/huggingface_gguf_selection_guide.html" style="color: #7FFF7F;">
30
+ Click here to get info on choosing the right GGUF model format
31
+ </a>
32
+
33
+ ---
34
+
35
+
36
+
37
+ <!--Begin Original Model Card-->
38
+
39
+
40
+
41
+ # SmolLM2
42
+
43
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/61c141342aac764ce1654e43/y45hIMNREW7w_XpHYB_0q.png)
44
+
45
+ ## Table of Contents
46
+
47
+ 1. [Model Summary](#model-summary)
48
+ 2. [Evaluation](#evaluation)
49
+ 3. [Examples](#examples)
50
+ 4. [Limitations](#limitations)
51
+ 5. [Training](#training)
52
+ 6. [License](#license)
53
+ 7. [Citation](#citation)
54
+
55
+ ## Model Summary
56
+
57
+ 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. More details in our paper: https://arxiv.org/abs/2502.02737v1
58
+
59
+ The 1.7B variant demonstrates significant advances over its predecessor SmolLM1-1.7B, particularly in instruction following, knowledge, reasoning, and mathematics. It was trained on 11 trillion tokens using a diverse dataset combination: FineWeb-Edu, DCLM, The Stack, along with new mathematics and coding datasets that 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).
60
+
61
+ The instruct model additionally supports tasks such as text rewriting, summarization and function calling 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).
62
+ You can find the SFT dataset here: https://huggingface.co/datasets/HuggingFaceTB/smoltalk.
63
+
64
+ For more details refer to: https://github.com/huggingface/smollm. You will find pre-training, post-training, evaluation and local inference code.
65
+
66
+ ### How to use
67
+
68
+ #### Transformers
69
+ ```bash
70
+ pip install transformers
71
+ ```
72
+
73
+ ```python
74
+ from transformers import AutoModelForCausalLM, AutoTokenizer
75
+ checkpoint = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
76
+
77
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
78
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
79
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
80
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
81
+
82
+ messages = [{"role": "user", "content": "What is the capital of France."}]
83
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
84
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
85
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
86
+ print(tokenizer.decode(outputs[0]))
87
+ ```
88
+
89
+
90
+ #### Chat in TRL
91
+ You can also use the TRL CLI to chat with the model from the terminal:
92
+ ```bash
93
+ pip install trl
94
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM2-1.7B-Instruct --device cpu
95
+ ```
96
+
97
+ #### Transformers.js
98
+
99
+ ```bash
100
+ npm i @huggingface/transformers
101
+ ```
102
+
103
+ ```js
104
+ import { pipeline } from "@huggingface/transformers";
105
+
106
+ // Create a text generation pipeline
107
+ const generator = await pipeline(
108
+ "text-generation",
109
+ "HuggingFaceTB/SmolLM2-1.7B-Instruct",
110
+ );
111
+
112
+ // Define the list of messages
113
+ const messages = [
114
+ { role: "system", content: "You are a helpful assistant." },
115
+ { role: "user", content: "Tell me a joke." },
116
+ ];
117
+
118
+ // Generate a response
119
+ const output = await generator(messages, { max_new_tokens: 128 });
120
+ console.log(output[0].generated_text.at(-1).content);
121
+ // "Why don't scientists trust atoms?\n\nBecause they make up everything!"
122
+ ```
123
+
124
+ ## Evaluation
125
+
126
+ 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.
127
+
128
+ ## Base Pre-Trained Model
129
+
130
+ | Metric | SmolLM2-1.7B | Llama-1B | Qwen2.5-1.5B | SmolLM1-1.7B |
131
+ |------------------|--------------|-------------|---------------|--------------|
132
+ | HellaSwag | **68.7** | 61.2 | 66.4 | 62.9 |
133
+ | ARC (Average) | **60.5** | 49.2 | 58.5 | 59.9 |
134
+ | PIQA | **77.6** | 74.8 | 76.1 | 76.0 |
135
+ | MMLU-Pro (MCF) | **19.4** | 11.7 | 13.7 | 10.8 |
136
+ | CommonsenseQA | **43.6** | 41.2 | 34.1 | 38.0 |
137
+ | TriviaQA | **36.7** | 28.1 | 20.9 | 22.5 |
138
+ | Winogrande | **59.4** | 57.8 | 59.3 | 54.7 |
139
+ | OpenBookQA | 42.2 | 38.4 | 40.0 | **42.4** |
140
+ | GSM8K (5-shot) | 31.0 | 7.2 | **61.3** | 5.5 |
141
+
142
+ ## Instruction Model
143
+
144
+ | Metric | SmolLM2-1.7B-Instruct | Llama-1B-Instruct | Qwen2.5-1.5B-Instruct | SmolLM1-1.7B-Instruct |
145
+ |:-----------------------------|:---------------------:|:-----------------:|:----------------------:|:----------------------:|
146
+ | IFEval (Average prompt/inst) | **56.7** | 53.5 | 47.4 | 23.1 |
147
+ | MT-Bench | 6.13 | 5.48 | **6.52** | 4.33 |
148
+ | OpenRewrite-Eval (micro_avg RougeL) | 44.9 | 39.2 | **46.9** | NaN |
149
+ | HellaSwag | **66.1** | 56.1 | 60.9 | 55.5 |
150
+ | ARC (Average) | **51.7** | 41.6 | 46.2 | 43.7 |
151
+ | PIQA | **74.4** | 72.3 | 73.2 | 71.6 |
152
+ | MMLU-Pro (MCF) | 19.3 | 12.7 | **24.2** | 11.7 |
153
+ | BBH (3-shot) | 32.2 | 27.6 | **35.3** | 25.7 |
154
+ | GSM8K (5-shot) | **48.2** | 26.8 | 42.8 | 4.62 |
155
+
156
+
157
+ ## Examples
158
+ Below are some system and instruct prompts that work well for special tasks
159
+
160
+ ### Text rewriting
161
+
162
+ ```python
163
+ system_prompt_rewrite = "You are an AI writing assistant. Your task is to rewrite the user's email to make it more professional and approachable while maintaining its main points and key message. Do not return any text other than the rewritten message."
164
+ user_prompt_rewrite = "Rewrite the message below to make it more friendly and approachable while maintaining its main points and key message. Do not add any new information or return any text other than the rewritten message\nThe message:"
165
+ messages = [{"role": "system", "content": system_prompt_rewrite}, {"role": "user", "content":f"{user_prompt_rewrite} The CI is failing after your last commit!"}]
166
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
167
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
168
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
169
+ print(tokenizer.decode(outputs[0]))
170
+ ```
171
+ ```
172
+ Hey there! I noticed that the CI isn't passing after your latest commit. Could you take a look and let me know what's going on? Thanks so much for your help!
173
+ ```
174
+
175
+ ### Summarization
176
+
177
+ ```python
178
+ system_prompt_summarize = "Provide a concise, objective summary of the input text in up to three sentences, focusing on key actions and intentions without using second or third person pronouns."
179
+ messages = [{"role": "system", "content": system_prompt_summarize}, {"role": "user", "content": INSERT_LONG_EMAIL}]
180
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
181
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
182
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
183
+ print(tokenizer.decode(outputs[0]))
184
+ ```
185
+
186
+ ### Function calling
187
+
188
+ SmolLM2-1.7B-Instruct can handle function calling, it scores 27% on the [BFCL Leaderboard](https://gorilla.cs.berkeley.edu/blogs/8_berkeley_function_calling_leaderboard.html). Here's how you can leverage it:
189
+
190
+ ```python
191
+ import json
192
+ import re
193
+ from typing import Optional
194
+
195
+ from jinja2 import Template
196
+ import torch
197
+ from transformers import AutoModelForCausalLM, AutoTokenizer
198
+ from transformers.utils import get_json_schema
199
+
200
+
201
+ system_prompt = Template("""You are an expert in composing functions. You are given a question and a set of possible functions.
202
+ Based on the question, you will need to make one or more function/tool calls to achieve the purpose.
203
+ If none of the functions can be used, point it out and refuse to answer.
204
+ If the given question lacks the parameters required by the function, also point it out.
205
+
206
+ You have access to the following tools:
207
+ <tools>{{ tools }}</tools>
208
+
209
+ The output MUST strictly adhere to the following format, and NO other text MUST be included.
210
+ The example format is as follows. Please make sure the parameter type is correct. If no function call is needed, please make the tool calls an empty list '[]'.
211
+ <tool_call>[
212
+ {"name": "func_name1", "arguments": {"argument1": "value1", "argument2": "value2"}},
213
+ ... (more tool calls as required)
214
+ ]</tool_call>""")
215
+
216
+
217
+ def prepare_messages(
218
+ query: str,
219
+ tools: Optional[dict[str, any]] = None,
220
+ history: Optional[list[dict[str, str]]] = None
221
+ ) -> list[dict[str, str]]:
222
+ """Prepare the system and user messages for the given query and tools.
223
+
224
+ Args:
225
+ query: The query to be answered.
226
+ tools: The tools available to the user. Defaults to None, in which case if a
227
+ list without content will be passed to the model.
228
+ history: Exchange of messages, including the system_prompt from
229
+ the first query. Defaults to None, the first message in a conversation.
230
+ """
231
+ if tools is None:
232
+ tools = []
233
+ if history:
234
+ messages = history.copy()
235
+ messages.append({"role": "user", "content": query})
236
+ else:
237
+ messages = [
238
+ {"role": "system", "content": system_prompt.render(tools=json.dumps(tools))},
239
+ {"role": "user", "content": query}
240
+ ]
241
+ return messages
242
+
243
+
244
+ def parse_response(text: str) -> str | dict[str, any]:
245
+ """Parses a response from the model, returning either the
246
+ parsed list with the tool calls parsed, or the
247
+ model thought or response if couldn't generate one.
248
+
249
+ Args:
250
+ text: Response from the model.
251
+ """
252
+ pattern = r"<tool_call>(.*?)</tool_call>"
253
+ matches = re.findall(pattern, text, re.DOTALL)
254
+ if matches:
255
+ return json.loads(matches[0])
256
+ return text
257
+
258
+
259
+ model_name_smollm = "HuggingFaceTB/SmolLM2-1.7B-Instruct"
260
+ model = AutoModelForCausalLM.from_pretrained(model_name_smollm, device_map="auto", torch_dtype="auto", trust_remote_code=True)
261
+ tokenizer = AutoTokenizer.from_pretrained(model_name_smollm)
262
+
263
+ from datetime import datetime
264
+ import random
265
+
266
+ def get_current_time() -> str:
267
+ """Returns the current time in 24-hour format.
268
+
269
+ Returns:
270
+ str: Current time in HH:MM:SS format.
271
+ """
272
+ return datetime.now().strftime("%H:%M:%S")
273
+
274
+
275
+ def get_random_number_between(min: int, max: int) -> int:
276
+ """
277
+ Gets a random number between min and max.
278
+
279
+ Args:
280
+ min: The minimum number.
281
+ max: The maximum number.
282
+
283
+ Returns:
284
+ A random number between min and max.
285
+ """
286
+ return random.randint(min, max)
287
+
288
+
289
+ tools = [get_json_schema(get_random_number_between), get_json_schema(get_current_time)]
290
+
291
+ toolbox = {"get_random_number_between": get_random_number_between, "get_current_time": get_current_time}
292
+
293
+ query = "Give me a number between 1 and 300"
294
+
295
+ messages = prepare_messages(query, tools=tools)
296
+
297
+ inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
298
+ outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
299
+ result = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
300
+
301
+ tool_calls = parse_response(result)
302
+ # [{'name': 'get_random_number_between', 'arguments': {'min': 1, 'max': 300}}
303
+
304
+ # Get tool responses
305
+ tool_responses = [toolbox.get(tc["name"])(*tc["arguments"].values()) for tc in tool_calls]
306
+ # [63]
307
+
308
+ # For the second turn, rebuild the history of messages:
309
+ history = messages.copy()
310
+ # Add the "parsed response"
311
+ history.append({"role": "assistant", "content": result})
312
+ query = "Can you give me the hour?"
313
+ history.append({"role": "user", "content": query})
314
+
315
+ inputs = tokenizer.apply_chat_template(history, add_generation_prompt=True, return_tensors="pt").to(model.device)
316
+ outputs = model.generate(inputs, max_new_tokens=512, do_sample=False, num_return_sequences=1, eos_token_id=tokenizer.eos_token_id)
317
+ result = tokenizer.decode(outputs[0][len(inputs[0]):], skip_special_tokens=True)
318
+
319
+ tool_calls = parse_response(result)
320
+ tool_responses = [toolbox.get(tc["name"])(*tc["arguments"].values()) for tc in tool_calls]
321
+ # ['07:57:25']
322
+ ```
323
+ More details such as parallel function calls and tools not available can be found [here](https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B-Instruct/blob/main/instructions_function_calling.md)
324
+
325
+ ## Limitations
326
+
327
+ 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.
328
+
329
+ ## Training
330
+
331
+ ### Model
332
+
333
+ - **Architecture:** Transformer decoder
334
+ - **Pretraining tokens:** 11T
335
+ - **Precision:** bfloat16
336
+
337
+ ### Hardware
338
+
339
+ - **GPUs:** 256 H100
340
+
341
+ ### Software
342
+
343
+ - **Training Framework:** [nanotron](https://github.com/huggingface/nanotron/tree/main)
344
+ - **Alignment Handbook** [alignment-handbook](https://github.com/huggingface/alignment-handbook/)
345
+
346
+ ## License
347
+
348
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
349
+
350
+ ## Citation
351
+ ```bash
352
+ @misc{allal2025smollm2smolgoesbig,
353
+ title={SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model},
354
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Guilherme Penedo and Lewis Tunstall and Andrés Marafioti and Hynek Kydlíček and Agustín Piqueres Lajarín and Vaibhav Srivastav and Joshua Lochner and Caleb Fahlgren and Xuan-Son Nguyen and Clémentine Fourrier and Ben Burtenshaw and Hugo Larcher and Haojun Zhao and Cyril Zakka and Mathieu Morlon and Colin Raffel and Leandro von Werra and Thomas Wolf},
355
+ year={2025},
356
+ eprint={2502.02737},
357
+ archivePrefix={arXiv},
358
+ primaryClass={cs.CL},
359
+ url={https://arxiv.org/abs/2502.02737},
360
+ }
361
+ ```
362
+
363
+ <!--End Original Model Card-->
364
+
365
+ ---
366
+
367
+ # <span id="testllm" style="color: #7F7FFF;">🚀 If you find these models useful</span>
368
+
369
+ Help me test my **AI-Powered Quantum Network Monitor Assistant** with **quantum-ready security checks**:
370
+
371
+ 👉 [Quantum Network Monitor](https://readyforquantum.com/?assistant=open&utm_source=huggingface&utm_medium=referral&utm_campaign=huggingface_repo_readme)
372
+
373
+
374
+ The full Open Source Code for the Quantum Network Monitor Service available at my github repos ( repos with NetworkMonitor in the name) : [Source Code Quantum Network Monitor](https://github.com/Mungert69). You will also find the code I use to quantize the models if you want to do it yourself [GGUFModelBuilder](https://github.com/Mungert69/GGUFModelBuilder)
375
+
376
+ 💬 **How to test**:
377
+ Choose an **AI assistant type**:
378
+ - `TurboLLM` (GPT-4.1-mini)
379
+ - `HugLLM` (Hugginface Open-source models)
380
+ - `TestLLM` (Experimental CPU-only)
381
+
382
+ ### **What I’m Testing**
383
+ I’m pushing the limits of **small open-source models for AI network monitoring**, specifically:
384
+ - **Function calling** against live network services
385
+ - **How small can a model go** while still handling:
386
+ - Automated **Nmap security scans**
387
+ - **Quantum-readiness checks**
388
+ - **Network Monitoring tasks**
389
+
390
+ 🟡 **TestLLM** – Current experimental model (llama.cpp on 2 CPU threads on huggingface docker space):
391
+ - ✅ **Zero-configuration setup**
392
+ - ⏳ 30s load time (slow inference but **no API costs**) . No token limited as the cost is low.
393
+ - 🔧 **Help wanted!** If you’re into **edge-device AI**, let’s collaborate!
394
+
395
+ ### **Other Assistants**
396
+ 🟢 **TurboLLM** – Uses **gpt-4.1-mini** :
397
+ - **It performs very well but unfortunatly OpenAI charges per token. For this reason tokens usage is limited.
398
+ - **Create custom cmd processors to run .net code on Quantum Network Monitor Agents**
399
+ - **Real-time network diagnostics and monitoring**
400
+ - **Security Audits**
401
+ - **Penetration testing** (Nmap/Metasploit)
402
+
403
+ 🔵 **HugLLM** – Latest Open-source models:
404
+ - 🌐 Runs on Hugging Face Inference API. Performs pretty well using the lastest models hosted on Novita.
405
+
406
+ ### 💡 **Example commands you could test**:
407
+ 1. `"Give me info on my websites SSL certificate"`
408
+ 2. `"Check if my server is using quantum safe encyption for communication"`
409
+ 3. `"Run a comprehensive security audit on my server"`
410
+ 4. '"Create a cmd processor to .. (what ever you want)" Note you need to install a Quantum Network Monitor Agent to run the .net code from. This is a very flexible and powerful feature. Use with caution!
411
+
412
+ ### Final Word
413
+
414
+ I fund the servers used to create these model files, run the Quantum Network Monitor service, and pay for inference from Novita and OpenAI—all out of my own pocket. All the code behind the model creation and the Quantum Network Monitor project is [open source](https://github.com/Mungert69). Feel free to use whatever you find helpful.
415
+
416
+ If you appreciate the work, please consider [buying me a coffee](https://www.buymeacoffee.com/mahadeva) ☕. Your support helps cover service costs and allows me to raise token limits for everyone.
417
+
418
+ I'm also open to job opportunities or sponsorship.
419
+
420
+ Thank you! 😊
SmolLM2-1.7B-Instruct-bf16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:950ee97c3c4c5adbc261ba74c5841cc4778a7073fb73329befa84762406100d1
3
+ size 3424736480
SmolLM2-1.7B-Instruct-bf16_q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f25c16641016df0ce99f4bc4fa285283af4b9d26ce42497fb18a4b928f3c2c9
3
+ size 2481018080
SmolLM2-1.7B-Instruct-f16_q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62b09b6208cf78d65120c1c22cd98ac2a0da892841741fc7222687284b29a330
3
+ size 2481018080
SmolLM2-1.7B-Instruct-iq3_m.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f8e81a33fdae790b05826b207150a83c527679e57da8e3c7d13b5c42912c5cf
3
+ size 783504896
SmolLM2-1.7B-Instruct-iq3_s.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1625404bef59d9d03cda5603e059e278b83bfed96577438a2b4de8aa6dfb0ce8
3
+ size 763450880
SmolLM2-1.7B-Instruct-iq3_xs.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7a9930438042c340737d3508487951bdcaf151ae9c182c57acdb7740fa739d1f
3
+ size 725702144
SmolLM2-1.7B-Instruct-iq3_xxs.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c9306174896ec8a9106b4cc65584af41a5b23783a5755229b3ba10a86aa86d2
3
+ size 685987328
SmolLM2-1.7B-Instruct-iq4_nl.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c40dd535cbbb6e48f33a05a929d4d1f8ba79e0d94eabc6aee40c73b2e63f4be0
3
+ size 990729728
SmolLM2-1.7B-Instruct-iq4_xs.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f14d70662258e1b7afdb103ed12735bf952d95cc28bb3baedf41468dd14b03a8
3
+ size 940398080
SmolLM2-1.7B-Instruct-q3_k_m.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edbb41e245617fb8fa490b047b8b86384e3a40cedea38746d903d3a85ed97950
3
+ size 852317696
SmolLM2-1.7B-Instruct-q3_k_s.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e42d3e67a01d0bd955c6d7320e47bb4c4b0f7fbcdb0ec18d709927ad0a2ff4aa
3
+ size 778786304
SmolLM2-1.7B-Instruct-q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0024095c63c763788d7151e26552aecd891cc0620175dc4f77ed7a7e8ce0a9ee
3
+ size 964777472
SmolLM2-1.7B-Instruct-q4_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aeced9aacbcd973a95634ec8d734d5232f96de82869e68b10c485f7b42934c7f
3
+ size 1071732224
SmolLM2-1.7B-Instruct-q4_k_m.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:07d23bc0d34bf70e8ba33489d7be54a4ffb7a577d7cd8ecf043510b4d43fe611
3
+ size 1042044416
SmolLM2-1.7B-Instruct-q4_k_s.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18547aa78980f37cf593eb639f8cdcfcc67f3fd80c275c44504f06133c70d853
3
+ size 1010128384
SmolLM2-1.7B-Instruct-q5_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ced2c7e912e5f7afb79e65119f071fcb029bc8970ad974a3a0d7d02ddf6009b
3
+ size 1178686976
SmolLM2-1.7B-Instruct-q5_1.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a9a96baa093aec644525d05cb8239ea92a0c6264a55990f6f3cbc54733f8f72
3
+ size 1285641728
SmolLM2-1.7B-Instruct-q5_k_m.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ba8e62dde6cd22ef7f025b96213a860f7b4a4b33fe5db6d461009654f752e33e
3
+ size 1228822016
SmolLM2-1.7B-Instruct-q5_k_s.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3cd6188f13fe0dde24187e1e8c6dc2b42f5cb77d4c2cbf8457e0290e7b93bde
3
+ size 1212110336
SmolLM2-1.7B-Instruct-q6_k_m.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:59340435561c61b0867068fad325cea4b8f4d441af88db14d27a93a10a56a4bd
3
+ size 1405965824
SmolLM2-1.7B-Instruct-q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eef23ebc1efd51895938f1fe35e25eb6eed9f31338a74061998a74f7df08edc0
3
+ size 1820415200
SmolLM2-1.7B-Instruct.imatrix ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f8400d7a105f1ade1948e4cc02bb1b1f6774c1e63772c22d31f98e14f0d2d80
3
+ size 1971650