mav23 commited on
Commit
6ebaed8
1 Parent(s): ecde23e

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +109 -0
  3. smollm-360m-instruct.Q4_0.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
+ smollm-360m-instruct.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: HuggingFaceTB/SmolLM-360M
4
+ tags:
5
+ - alignment-handbook
6
+ - trl
7
+ - sft
8
+ datasets:
9
+ - Magpie-Align/Magpie-Pro-300K-Filtered
10
+ - bigcode/self-oss-instruct-sc2-exec-filter-50k
11
+ - teknium/OpenHermes-2.5
12
+ - HuggingFaceTB/everyday-conversations-llama3.1-2k
13
+ library_name: transformers
14
+ language:
15
+ - en
16
+ ---
17
+
18
+
19
+ # SmolLM-360M-Instruct
20
+
21
+ <center>
22
+ <img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
23
+ </center>
24
+
25
+
26
+ ## Model Summary
27
+ Chat with the model at: https://huggingface.co/spaces/HuggingFaceTB/instant-smol
28
+
29
+ SmolLM is a series of language models available in three sizes: 135M, 360M, and 1.7B parameters.
30
+
31
+ These models are trained on [SmolLM-Corpus](https://huggingface.co/datasets/HuggingFaceTB/smollm-corpus), a curated collection of high-quality educational and synthetic data designed for training LLMs. For further details, we refer to our [blogpost](https://huggingface.co/blog/smollm).
32
+
33
+ To build SmolLM-Instruct, we finetune the base models on publicly available datasets.
34
+
35
+ ## Changelog
36
+
37
+ |Release|Description|
38
+ |-|-|
39
+ |v0.1| Initial release of SmolLM-Instruct. We finetune on the permissive subset of the [WebInstructSub](https://huggingface.co/datasets/TIGER-Lab/WebInstructSub) dataset, combined with [StarCoder2-Self-OSS-Instruct](https://huggingface.co/datasets/bigcode/self-oss-instruct-sc2-exec-filter-50k). Then, we perform DPO (Direct Preference Optimization) for one epoch on [HelpSteer](https://huggingface.co/datasets/nvidia/HelpSteer) for the 135M and 1.7B models, and [argilla/dpo-mix-7k](https://huggingface.co/datasets/argilla/dpo-mix-7k) for the 360M model.|
40
+ |v0.2| We changed the finetuning mix to datasets more suitable for smol models. We train on a new dataset of 2k simple everyday conversations we generated by llama3.1-70B [everyday-conversations-llama3.1-2k](https://huggingface.co/datasets/HuggingFaceTB/everyday-conversations-llama3.1-2k/), [Magpie-Pro-300K-Filtere](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-300K-Filtered), [StarCoder2-Self-OSS-Instruct](https://huggingface.co/datasets/bigcode/self-oss-instruct-sc2-exec-filter-50k), and a small subset of [OpenHermes-2.5](https://huggingface.co/datasets/teknium/OpenHermes-2.5)|
41
+
42
+
43
+ v0.2 models are better at staying on topic and responding appropriately to standard prompts, such as greetings and questions about their role as AI assistants. SmolLM-360M-Instruct (v0.2) has a 63.3% win rate over SmolLM-360M-Instruct (v0.1) on AlpacaEval. You can find the details [here](https://huggingface.co/datasets/HuggingFaceTB/alpaca_eval_details/).
44
+
45
+ You can load v0.1 models by specifying `revision="v0.1"` in the transformers code:
46
+ ```python
47
+ model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM-360M-Instruct", revision="v0.1")
48
+ ```
49
+
50
+ ## Usage
51
+
52
+ ### Local Applications
53
+ ⚡ For local applications, you can find optimized implementations of the model in MLC, GGUF and Transformers.js formats, in addition to fast in-browser demos in this collection: https://huggingface.co/collections/HuggingFaceTB/local-smollms-66c0f3b2a15b4eed7fb198d0
54
+
55
+ We noticed that 4bit quantization degrades the quality of the 135M and 360M, so we use `q016` for MLC and ONNX/Transformers.js checkpoints for the WebGPU demos. We also suggest using temperature 0.2 and top-p 0.9.
56
+
57
+ ### Transformers
58
+ ```bash
59
+ pip install transformers
60
+ ```
61
+
62
+ ```python
63
+ # pip install transformers
64
+ from transformers import AutoModelForCausalLM, AutoTokenizer
65
+ checkpoint = "HuggingFaceTB/SmolLM-360M-Instruct"
66
+
67
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
68
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
69
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
70
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
71
+
72
+ messages = [{"role": "user", "content": "What is the capital of France."}]
73
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
74
+ print(input_text)
75
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
76
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
77
+ print(tokenizer.decode(outputs[0]))
78
+ ```
79
+
80
+ ### Chat in TRL
81
+ You can also use the TRL CLI to chat with the model from the terminal:
82
+ ```bash
83
+ pip install trl
84
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM-360M-Instruct --device cpu
85
+ ```
86
+
87
+ ## Limitations
88
+
89
+ Additionally, the generated content may not always be factually accurate, logically consistent, or free from biases present in the training data, we invite users to leverage them as assistive tools rather than definitive sources of information. We find that they can handle general knowledge questions, creative writing and basic Python programming. But they are English only and may have difficulty with arithmetics, editing tasks and complex reasoning. For more details about the models' capabilities, please refer to our [blog post](https://huggingface.co/blog/smollm).
90
+
91
+ ## Training parameters
92
+ We train the models using the [alignment-handbook](https://github.com/huggingface/alignment-handbook) with the datasets mentioned in the changelog, using these parameters for v0.2 (most of them are from Zephyr Gemma recipe):
93
+ - 1 epoch
94
+ - lr 1e-3
95
+ - cosine schedule
96
+ - warmup ratio 0.1
97
+ - global batch size 262k tokens
98
+
99
+ You can find the training recipe here: https://github.com/huggingface/alignment-handbook/tree/smollm/recipes/smollm
100
+
101
+
102
+ # Citation
103
+ ```bash
104
+ @misc{allal2024SmolLM,
105
+ title={SmolLM - blazingly fast and remarkably powerful},
106
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
107
+ year={2024},
108
+ }
109
+ ```
smollm-360m-instruct.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9df8ca920a48aa3e4acd188821f0c244e20d27d2b5fe312308091ebb3ceed890
3
+ size 229118944