eliebak HF staff commited on
Commit
6a3eeb1
1 Parent(s): 0691f98

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -7
README.md CHANGED
@@ -12,13 +12,6 @@ language:
12
  <img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
13
  </center>
14
 
15
- ## Table of Contents
16
-
17
- 1. [Model Summary](##model-summary)
18
- 2. [Limitations](##limitations)
19
- 3. [Training](##training)
20
- 4. [License](##license)
21
- 5. [Citation](##citation)
22
 
23
  ## Model Summary
24
 
@@ -29,6 +22,30 @@ To build SmolLM-Instruct, we instruction tuned the models using publicly availab
29
 
30
  This is the SmolLM-360M-Instruct.
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  # Limitations
33
 
34
  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.
 
12
  <img src="https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png" alt="SmolLM" width="1100" height="600">
13
  </center>
14
 
 
 
 
 
 
 
 
15
 
16
  ## Model Summary
17
 
 
22
 
23
  This is the SmolLM-360M-Instruct.
24
 
25
+ ### Generation
26
+ ```bash
27
+ pip install transformers
28
+ ```
29
+
30
+ ```python
31
+ # pip install transformers
32
+ from transformers import AutoModelForCausalLM, AutoTokenizer
33
+ checkpoint = "HuggingFaceTB/SmolLM-1.7B-Instruct"
34
+
35
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
36
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
37
+ # for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
38
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
39
+
40
+ messages = [{"role": "user", "content": "List the steps to bake a chocolate cake from scratch."}]
41
+ input_text=tokenizer.apply_chat_template(messages, tokenize=False)
42
+ print(input_text)
43
+ inputs = tokenizer.encode(input_text, return_tensors="pt").to("cuda")
44
+ outputs = model.generate(inputs, max_new_tokens=100, temperature=0.6, top_p=0.92, do_sample=True)
45
+ print(tokenizer.decode(outputs[0]))
46
+ ```
47
+
48
+
49
  # Limitations
50
 
51
  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.