mav23 commited on
Commit
5909b5a
1 Parent(s): 7fed200

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +107 -0
  3. smollm-1.7b-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-1.7b-instruct.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: HuggingFaceTB/SmolLM-1.7B
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
+ # SmolLM-1.7B-Instruct
19
+
20
+ <center>
21
+ <img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
22
+ </center>
23
+
24
+
25
+ ## Model Summary
26
+
27
+ SmolLM is a series of small language models available in three sizes: 135M, 360M, and 1.7B parameters.
28
+
29
+ These models are pre-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).
30
+
31
+ To build SmolLM-Instruct, we finetuned the base models on publicly available datasets.
32
+
33
+ ## Changelog
34
+
35
+
36
+ |Release|Description|
37
+ |-|-|
38
+ |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.|
39
+ |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-Filtered](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)|
40
+
41
+ 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/).
42
+
43
+ You can load v0.1 checkpoint by specifying `revision="v0.1"` in the transformers code:
44
+ ```python
45
+ model = AutoModelForCausalLM.from_pretrained("HuggingFaceTB/SmolLM-1.7B-Instruct", revision="v0.1")
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ### Local Applications
51
+ ⚡ 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
52
+
53
+ 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.
54
+
55
+ ### Transformers
56
+ ```bash
57
+ pip install transformers
58
+ ```
59
+
60
+ ```python
61
+ # pip install transformers
62
+ from transformers import AutoModelForCausalLM, AutoTokenizer
63
+ checkpoint = "HuggingFaceTB/SmolLM-1.7B-Instruct"
64
+
65
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
66
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
67
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
68
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
69
+
70
+ messages = [{"role": "user", "content": "What is the capital of France."}]
71
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
72
+ print(input_text)
73
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
74
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
75
+ print(tokenizer.decode(outputs[0]))
76
+ ```
77
+
78
+ ### Chat in TRL
79
+ You can also use the TRL CLI to chat with the model from the terminal:
80
+ ```bash
81
+ pip install trl
82
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM-1.7B-Instruct --device cpu
83
+ ```
84
+
85
+ ## Limitations
86
+
87
+ 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).
88
+
89
+ ## Training parameters
90
+ We train the models using the [alignment-handbook](https://github.com/huggingface/alignment-handbook) with the datasets mentioned in the changelog, using these parameters v0.2 (most of them are from Zephyr Gemma recipe):
91
+
92
+ - 1 epoch
93
+ - lr 1e-3
94
+ - cosine schedule
95
+ - warmup ratio 0.1
96
+ - global batch size 262k tokens
97
+
98
+ You can find the training recipe here: https://github.com/huggingface/alignment-handbook/tree/smollm/recipes/smollm
99
+
100
+ # Citation
101
+ ```bash
102
+ @misc{allal2024SmolLM,
103
+ title={SmolLM - blazingly fast and remarkably powerful},
104
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
105
+ year={2024},
106
+ }
107
+ ```
smollm-1.7b-instruct.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a88c6fecc40736dfb473f2d61d4c6f9d6b9c0dec660c2301706aee342fe9f84
3
+ size 990729248