Transformers
GGUF
English
Inference Endpoints
mav23 commited on
Commit
1272a5e
·
verified ·
1 Parent(s): 5dafb8d

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +127 -0
  3. smollm-360m.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.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: apache-2.0
4
+ language:
5
+ - en
6
+ datasets:
7
+ - HuggingFaceTB/smollm-corpus
8
+ ---
9
+
10
+
11
+ # SmolLM
12
+
13
+ <center>
14
+ <img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
15
+ </center>
16
+
17
+ ## Table of Contents
18
+
19
+ 1. [Model Summary](##model-summary)
20
+ 2. [Limitations](##limitations)
21
+ 3. [Training](##training)
22
+ 4. [License](##license)
23
+ 5. [Citation](##citation)
24
+
25
+ ## Model Summary
26
+
27
+ SmolLM is a series of state-of-the-art small language models available in three sizes: 135M, 360M, and 1.7B parameters. These models are built on Cosmo-Corpus, a meticulously curated high-quality training dataset. Cosmo-Corpus includes Cosmopedia v2 (28B tokens of synthetic textbooks and stories generated by Mixtral), Python-Edu (4B tokens of educational Python samples from The Stack), and FineWeb-Edu (220B tokens of deduplicated educational web samples from FineWeb). SmolLM models have shown promising results when compared to other models in their size categories across various benchmarks testing common sense reasoning and world knowledge. For detailed information on training, benchmarks and performance, please refer to our full [blog post](https://huggingface.co/blog/smollm).
28
+
29
+ This is the SmolLM-360M
30
+
31
+ ### Generation
32
+ ```bash
33
+ pip install transformers
34
+ ```
35
+
36
+ #### Running the model on CPU/GPU/multi GPU
37
+ * _Using full precision_
38
+ ```python
39
+ # pip install transformers
40
+ from transformers import AutoModelForCausalLM, AutoTokenizer
41
+ checkpoint = "HuggingFaceTB/SmolLM-360M"
42
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
43
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
44
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
45
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
46
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
47
+ outputs = model.generate(inputs)
48
+ print(tokenizer.decode(outputs[0]))
49
+
50
+ * _Using `torch.bfloat16`_
51
+ ```python
52
+ # pip install accelerate
53
+ import torch
54
+ from transformers import AutoTokenizer, AutoModelForCausalLM
55
+ checkpoint = "HuggingFaceTB/SmolLM-360M"
56
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
57
+ # for fp16 use `torch_dtype=torch.float16` instead
58
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
59
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
60
+ outputs = model.generate(inputs)
61
+ print(tokenizer.decode(outputs[0]))
62
+ ```
63
+ ```bash
64
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
65
+ Memory footprint: 723.56 MB
66
+ ```
67
+
68
+ #### Quantized Versions through `bitsandbytes`
69
+ * _Using 8-bit precision (int8)_
70
+
71
+ ```python
72
+ # pip install bitsandbytes accelerate
73
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
74
+ # to use 4bit use `load_in_4bit=True` instead
75
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
76
+ checkpoint = "HuggingFaceTB/SmolLM-360M"
77
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
78
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
79
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
80
+ outputs = model.generate(inputs)
81
+ print(tokenizer.decode(outputs[0]))
82
+ ```
83
+ ```bash
84
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
85
+ # load_in_8bit
86
+ Memory footprint: 409.07 MB
87
+ # load_in_4bit
88
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
89
+ Memory footprint: 251.79 MB
90
+ ```
91
+
92
+ # Limitations
93
+
94
+ While SmolLM models have been trained on a diverse dataset including educational content and synthetic texts, they have limitations. The 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. For a more comprehensive discussion of the models' capabilities and limitations, please refer to our full [blog post](https://huggingface.co/blog/smollm)..
95
+
96
+ This repository contains a converted version of our latest trained model. We've noticed a small performance difference between this converted checkpoint (transformers) and the original (nanotron). We're currently working to resolve this issue.
97
+ # Training
98
+
99
+ ## Model
100
+
101
+ - **Architecture:** For architecture detail, see the [blog post](https://huggingface.co/blog/smollm).
102
+ - **Pretraining steps:** 600k
103
+ - **Pretraining tokens:** 600B
104
+ - **Precision:** bfloat16
105
+ - **Tokenizer:** [HuggingFaceTB/cosmo2-tokenizer](https://huggingface.co/HuggingFaceTB/cosmo2-tokenizer)
106
+
107
+
108
+ ## Hardware
109
+
110
+ - **GPUs:** 64 H100
111
+
112
+ ## Software
113
+
114
+ - **Training Framework:** [Nanotron](https://github.com/huggingface/nanotron/tree/main)
115
+
116
+ # License
117
+
118
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
119
+
120
+ # Citation
121
+ ```bash
122
+ @misc{allal2024SmolLM,
123
+ title={SmolLM - blazingly fast and remarkably powerful},
124
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
125
+ year={2024},
126
+ }
127
+ ```
smollm-360m.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1a42a8867e9539e24fc272d7131e3ed6dc2a67c4e119cad065d48c145508411
3
+ size 229118080