aashish1904 commited on
Commit
728605f
1 Parent(s): 50a28e8

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +111 -0
README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ license: apache-2.0
5
+ base_model: HuggingFaceTB/SmolLM-360M
6
+ tags:
7
+ - alignment-handbook
8
+ - trl
9
+ - sft
10
+ datasets:
11
+ - Magpie-Align/Magpie-Pro-300K-Filtered
12
+ - bigcode/self-oss-instruct-sc2-exec-filter-50k
13
+ - teknium/OpenHermes-2.5
14
+ - HuggingFaceTB/everyday-conversations-llama3.1-2k
15
+ library_name: transformers
16
+ language:
17
+ - en
18
+
19
+ ---
20
+
21
+ ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
22
+
23
+ # QuantFactory/smollm-360M-instruct-add-basics-GGUF
24
+ This is quantized version of [HuggingFaceTB/smollm-360M-instruct-add-basics](https://huggingface.co/HuggingFaceTB/smollm-360M-instruct-add-basics) created using llama.cpp
25
+
26
+ # Original Model Card
27
+
28
+
29
+
30
+ # SmolLM-360M-Instruct
31
+
32
+ <center>
33
+ <img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
34
+ </center>
35
+
36
+
37
+ ## Model Summary
38
+ Chat with the model at: https://huggingface.co/spaces/HuggingFaceTB/instant-smol
39
+
40
+ SmolLM is a series of language models available in three sizes: 135M, 360M, and 1.7B parameters.
41
+
42
+ 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).
43
+
44
+ To build SmolLM-Instruct, we finetune the base models on publicly available datasets.
45
+
46
+ ## Changelog
47
+
48
+ |Release|Description|
49
+ |-|-|
50
+ |v0.1| Initial release of SmolLM-Instruct. We finetune on the permissive subset of the WebInstructSub dataset, combined with StarCoder2-Self-OSS-Instruct. Then, we perform DPO (Direct Preference Optimization) for one epoch on HelpSteer for the 135M and 1.7B models, and argilla/dpo-mix-7k for the 360M model.|
51
+ |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), [self-oss-instruct-sc2-exec-filter-50k](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)|
52
+
53
+ We've noticed that the 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. Additionally, 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/).
54
+
55
+ ## Usage
56
+
57
+ ### Local Applications
58
+ ⚡ 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
59
+
60
+ 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.
61
+
62
+ ### Transformers
63
+ ```bash
64
+ pip install transformers
65
+ ```
66
+
67
+ ```python
68
+ # pip install transformers
69
+ from transformers import AutoModelForCausalLM, AutoTokenizer
70
+ checkpoint = "HuggingFaceTB/SmolLM-360M-Instruct"
71
+
72
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
73
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
74
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
75
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
76
+
77
+ messages = [{"role": "user", "content": "What is the capital of France."}]
78
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
79
+ print(input_text)
80
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
81
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
82
+ print(tokenizer.decode(outputs[0]))
83
+ ```
84
+
85
+ ### Chat in TRL
86
+ You can also use the TRL CLI to chat with the model from the terminal:
87
+ ```bash
88
+ pip install trl
89
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM-360M-Instruct --device cpu
90
+ ```
91
+
92
+ ## Limitations
93
+
94
+ 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).
95
+
96
+ ## Training parameters
97
+ We train the models using the [alignement-handbook](https://github.com/huggingface/alignment-handbook) with the datasets mentioned in the changelog, using these parameters for v0.2:
98
+ - 1 epoch
99
+ - lr 1e-3
100
+ - cosine schedule
101
+ - warmup ratio 0.1
102
+ - global batch size 262k tokens
103
+
104
+ # Citation
105
+ ```bash
106
+ @misc{allal2024SmolLM,
107
+ title={SmolLM - blazingly fast and remarkably powerful},
108
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
109
+ year={2024},
110
+ }
111
+ ```