Transformers
GGUF
English
Inference Endpoints
aashish1904 commited on
Commit
c5c8b16
1 Parent(s): 68badd9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +140 -0
README.md ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ library_name: transformers
5
+ license: apache-2.0
6
+ language:
7
+ - en
8
+ datasets:
9
+ - HuggingFaceTB/smollm-corpus
10
+
11
+ ---
12
+
13
+ ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
14
+
15
+ # QuantFactory/SmolLM-135M-GGUF
16
+ This is quantized version of [HuggingFaceTB/SmolLM-135M](https://huggingface.co/HuggingFaceTB/SmolLM-135M) created using llama.cpp
17
+
18
+ # Original Model Card
19
+
20
+
21
+
22
+ # SmolLM
23
+
24
+ <center>
25
+ <img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
26
+ </center>
27
+
28
+ ## Table of Contents
29
+
30
+ 1. [Model Summary](##model-summary)
31
+ 2. [Limitations](##limitations)
32
+ 3. [Training](##training)
33
+ 4. [License](##license)
34
+ 5. [Citation](##citation)
35
+
36
+ ## Model Summary
37
+
38
+ 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).
39
+
40
+ This is the SmolLM-135M
41
+
42
+ ### Generation
43
+ ```bash
44
+ pip install transformers
45
+ ```
46
+
47
+ #### Running the model on CPU/GPU/multi GPU
48
+ * _Using full precision_
49
+ ```python
50
+ # pip install transformers
51
+ from transformers import AutoModelForCausalLM, AutoTokenizer
52
+ checkpoint = "HuggingFaceTB/SmolLM-135M"
53
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
54
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
55
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
56
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
57
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
58
+ outputs = model.generate(inputs)
59
+ print(tokenizer.decode(outputs[0]))
60
+ ```
61
+ ```bash
62
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
63
+ Memory footprint: 12624.81 MB
64
+ ```
65
+ * _Using `torch.bfloat16`_
66
+ ```python
67
+ # pip install accelerate
68
+ import torch
69
+ from transformers import AutoTokenizer, AutoModelForCausalLM
70
+ checkpoint = "HuggingFaceTB/SmolLM-135M"
71
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
72
+ # for fp16 use `torch_dtype=torch.float16` instead
73
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
74
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
75
+ outputs = model.generate(inputs)
76
+ print(tokenizer.decode(outputs[0]))
77
+ ```
78
+ ```bash
79
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
80
+ Memory footprint: 269.03 MB
81
+ ```
82
+
83
+ #### Quantized Versions through `bitsandbytes`
84
+ * _Using 8-bit precision (int8)_
85
+
86
+ ```python
87
+ # pip install bitsandbytes accelerate
88
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
89
+ # to use 4bit use `load_in_4bit=True` instead
90
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
91
+ checkpoint = "HuggingFaceTB/SmolLM-135M"
92
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
93
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
94
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
95
+ outputs = model.generate(inputs)
96
+ print(tokenizer.decode(outputs[0]))
97
+ ```
98
+ ```bash
99
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
100
+ # load_in_8bit
101
+ Memory footprint: 162.87 MB
102
+ # load_in_4bit
103
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
104
+ Memory footprint: 109.78 MB
105
+ ```
106
+
107
+ # Limitations
108
+
109
+ 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)..
110
+
111
+ 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.
112
+ # Training
113
+
114
+ ## Model
115
+
116
+ - **Architecture:** For architecture detail, see the [blog post](https://huggingface.co/blog/smollm).
117
+ - **Pretraining steps:** 600k
118
+ - **Pretraining tokens:** 600B
119
+ - **Precision:** bfloat16
120
+
121
+ ## Hardware
122
+
123
+ - **GPUs:** 64 H100
124
+
125
+ ## Software
126
+
127
+ - **Training Framework:** [Nanotron](https://github.com/huggingface/nanotron/tree/main)
128
+
129
+ # License
130
+
131
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
132
+
133
+ # Citation
134
+ ```bash
135
+ @misc{allal2024SmolLM,
136
+ title={SmolLM - blazingly fast and remarkably powerful},
137
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
138
+ year={2024},
139
+ }
140
+ ```