ariG23498 HF Staff commited on
Commit
6f9ad5e
·
verified ·
1 Parent(s): 6c180bb

Upload HuggingFaceTB_SmolLM3-3B_5.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. HuggingFaceTB_SmolLM3-3B_5.txt +29 -0
HuggingFaceTB_SmolLM3-3B_5.txt ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```CODE:
2
+ prompt = "Give me a brief explanation of gravity in simple terms."
3
+ messages = [
4
+ {"role": "system", "content": "/no_think"},
5
+ {"role": "user", "content": prompt}
6
+ ]
7
+
8
+ text = tokenizer.apply_chat_template(
9
+ messages,
10
+ tokenize=False,
11
+ add_generation_prompt=True,
12
+ )
13
+
14
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
15
+
16
+ # Generate the output
17
+ generated_ids = model.generate(**model_inputs, max_new_tokens=32768)
18
+
19
+ # Get and decode the output
20
+ output_ids = generated_ids[0][len(model_inputs.input_ids[0]) :]
21
+ print(tokenizer.decode(output_ids, skip_special_tokens=True))
22
+ ```
23
+
24
+ ERROR:
25
+ Traceback (most recent call last):
26
+ File "/tmp/HuggingFaceTB_SmolLM3-3B_5GpHfS5.py", line 22, in <module>
27
+ text = tokenizer.apply_chat_template(
28
+ ^^^^^^^^^
29
+ NameError: name 'tokenizer' is not defined