loubnabnl HF staff commited on
Commit
6f35b5b
1 Parent(s): d235430

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +71 -50
README.md CHANGED
@@ -5,73 +5,94 @@ tags:
5
  - alignment-handbook
6
  - trl
7
  - sft
8
- - generated_from_trainer
9
- - trl
10
- - sft
11
- - generated_from_trainer
12
  datasets:
13
- - HuggingFaceTB/Magpie-Pro-300K-Filtered-H4
14
- - HuggingFaceTB/self-oss-instruct-sc2-H4
15
- - HuggingFaceTB/OpenHermes-2.5-H4
16
- - HuggingFaceTB/everyday-topics-MT-conversations-H4
17
- - HuggingFaceTB/instruct-data-basics-H4
18
- model-index:
19
- - name: smollm-350M-instruct-add-basics
20
- results: []
21
  library_name: transformers
 
 
22
  ---
23
 
24
- <!-- This model card has been generated automatically according to the information the Trainer had access to. You
25
- should probably proofread and complete it, then remove this comment. -->
26
 
27
- [<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/loubnabnl/huggingface/runs/bfq0ndat)
28
- # smollm-350M-instruct-add-basics
 
 
 
 
 
 
 
 
 
 
 
29
 
30
- This model is a fine-tuned version of [HuggingFaceTB/SmolLM-360M](https://huggingface.co/HuggingFaceTB/SmolLM-360M) on the HuggingFaceTB/Magpie-Pro-300K-Filtered-H4, the HuggingFaceTB/self-oss-instruct-sc2-H4, the HuggingFaceTB/OpenHermes-2.5-H4, the HuggingFaceTB/everyday-topics-MT-conversations-H4 and the HuggingFaceTB/instruct-data-basics-H4 datasets.
31
- It achieves the following results on the evaluation set:
32
- - Loss: 1.2039
33
 
34
- ## Model description
35
 
36
- More information needed
 
 
 
37
 
38
- ## Intended uses & limitations
39
 
40
- More information needed
 
41
 
42
- ## Training and evaluation data
43
 
44
- More information needed
 
 
 
45
 
46
- ## Training procedure
 
 
 
47
 
48
- ### Training hyperparameters
 
 
 
49
 
50
- The following hyperparameters were used during training:
51
- - learning_rate: 0.001
52
- - train_batch_size: 4
53
- - eval_batch_size: 4
54
- - seed: 42
55
- - distributed_type: multi-GPU
56
- - num_devices: 8
57
- - gradient_accumulation_steps: 4
58
- - total_train_batch_size: 128
59
- - total_eval_batch_size: 32
60
- - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
61
- - lr_scheduler_type: cosine
62
- - lr_scheduler_warmup_ratio: 0.1
63
- - num_epochs: 1
64
 
65
- ### Training results
 
 
 
 
 
66
 
67
- | Training Loss | Epoch | Step | Validation Loss |
68
- |:-------------:|:------:|:----:|:---------------:|
69
- | 0.8459 | 0.9991 | 817 | 1.2039 |
70
 
 
71
 
72
- ### Framework versions
 
 
 
 
 
 
73
 
74
- - Transformers 4.42.3
75
- - Pytorch 2.1.2
76
- - Datasets 2.20.0
77
- - Tokenizers 0.19.1
 
 
 
 
 
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 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.|
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](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)|
41
 
42
+ ## Usage
43
 
44
+ ### Local Applications
45
+ ⚡ 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
46
 
47
+ 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.
48
 
49
+ ### Transformers
50
+ ```bash
51
+ pip install transformers
52
+ ```
53
 
54
+ ```python
55
+ # pip install transformers
56
+ from transformers import AutoModelForCausalLM, AutoTokenizer
57
+ checkpoint = "HuggingFaceTB/SmolLM-360M-Instruct"
58
 
59
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
60
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
61
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
62
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
63
 
64
+ messages = [{"role": "user", "content": "What is the capital of France."}]
65
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
66
+ print(input_text)
67
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
68
+ outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
69
+ print(tokenizer.decode(outputs[0]))
70
+ ```
 
 
 
 
 
 
 
71
 
72
+ ### Chat in TRL
73
+ You can also use the TRL CLI to chat with the model from the terminal:
74
+ ```bash
75
+ pip install trl
76
+ trl chat --model_name_or_path HuggingFaceTB/SmolLM-360M-Instruct --device cpu
77
+ ```
78
 
79
+ ## Limitations
 
 
80
 
81
+ 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).
82
 
83
+ ## Training parameters
84
+ 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:
85
+ - 1 epoch
86
+ - lr 1e-3
87
+ - cosine schedule
88
+ - warmup ratio 0.1
89
+ - global batch size 262k tokens
90
 
91
+ # Citation
92
+ ```bash
93
+ @misc{allal2024SmolLM,
94
+ title={SmolLM - blazingly fast and remarkably powerful},
95
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
96
+ year={2024},
97
+ }
98
+ ```