Transformers
GGUF
English
Inference Endpoints
aashish1904 commited on
Commit
74ea5e5
1 Parent(s): c13ecbe

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +139 -0
README.md ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-1.7B-GGUF
16
+ This is quantized version of [HuggingFaceTB/SmolLM-1.7B](https://huggingface.co/HuggingFaceTB/SmolLM-1.7B) 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
+
41
+ This is SmolLM-1.7B
42
+
43
+ ### Generation
44
+
45
+ ```bash
46
+ pip install transformers
47
+ ```
48
+
49
+ #### Running the model on CPU/GPU/multi GPU
50
+ * _Using full precision_
51
+ ```python
52
+ # pip install transformers
53
+ from transformers import AutoModelForCausalLM, AutoTokenizer
54
+ checkpoint = "HuggingFaceTB/SmolLM-1.7B"
55
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
56
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
57
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
58
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
59
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to(device)
60
+ outputs = model.generate(inputs)
61
+ print(tokenizer.decode(outputs[0]))
62
+ ```
63
+
64
+ * _Using `torch.bfloat16`_
65
+ ```python
66
+ # pip install accelerate
67
+ import torch
68
+ from transformers import AutoTokenizer, AutoModelForCausalLM
69
+ checkpoint = "HuggingFaceTB/SmolLM-1.7B"
70
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
71
+ # for fp16 use `torch_dtype=torch.float16` instead
72
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto", torch_dtype=torch.bfloat16)
73
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
74
+ outputs = model.generate(inputs)
75
+ print(tokenizer.decode(outputs[0]))
76
+ ```
77
+ ```bash
78
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
79
+ Memory footprint: 3422.76 MB
80
+ ```
81
+
82
+ #### Quantized Versions through `bitsandbytes`
83
+ * _Using 8-bit precision (int8)_
84
+
85
+ ```python
86
+ # pip install bitsandbytes accelerate
87
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
88
+ # to use 4bit use `load_in_4bit=True` instead
89
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True)
90
+ checkpoint = "HuggingFaceTB/SmolLM-1.7B"
91
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
92
+ model = AutoModelForCausalLM.from_pretrained(checkpoint, quantization_config=quantization_config)
93
+ inputs = tokenizer.encode("def print_hello_world():", return_tensors="pt").to("cuda")
94
+ outputs = model.generate(inputs)
95
+ print(tokenizer.decode(outputs[0]))
96
+ ```
97
+ ```bash
98
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
99
+ # load_in_8bit
100
+ Memory footprint: 1812.14 MB
101
+ # load_in_4bit
102
+ >>> print(f"Memory footprint: {model.get_memory_footprint() / 1e6:.2f} MB")
103
+ Memory footprint: 1006.84 MB
104
+ ```
105
+
106
+ # Limitations
107
+
108
+ 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).
109
+
110
+ 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.
111
+ # Training
112
+
113
+ ## Model
114
+
115
+ - **Architecture:** For architecture detail, see the [blog post](https://huggingface.co/blog/smollm).
116
+ - **Pretraining steps:** 500k
117
+ - **Pretraining tokens:** 1T
118
+ - **Precision:** bfloat16
119
+
120
+ ## Hardware
121
+
122
+ - **GPUs:** 64 H100
123
+
124
+ ## Software
125
+
126
+ - **Training Framework:** [Nanotron](https://github.com/huggingface/nanotron/tree/main)
127
+
128
+ # License
129
+
130
+ [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
131
+
132
+ # Citation
133
+ ```bash
134
+ @misc{allal2024SmolLM,
135
+ title={SmolLM - blazingly fast and remarkably powerful},
136
+ author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Leandro von Werra and Thomas Wolf},
137
+ year={2024},
138
+ }
139
+ ```