Upload HuggingFaceTB_SmolLM3-3B_6.txt with huggingface_hub
Browse files
HuggingFaceTB_SmolLM3-3B_6.txt
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
```CODE:
|
| 2 |
+
tools = [
|
| 3 |
+
{
|
| 4 |
+
"name": "get_weather",
|
| 5 |
+
"description": "Get the weather in a city",
|
| 6 |
+
"parameters": {"type": "object", "properties": {"city": {"type": "string", "description": "The city to get the weather for"}}}}
|
| 7 |
+
]
|
| 8 |
+
|
| 9 |
+
messages = [
|
| 10 |
+
{
|
| 11 |
+
"role": "user",
|
| 12 |
+
"content": "Hello! How is the weather today in Copenhagen?"
|
| 13 |
+
}
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
inputs = tokenizer.apply_chat_template(
|
| 17 |
+
messages,
|
| 18 |
+
enable_thinking=False, # True works as well, your choice!
|
| 19 |
+
xml_tools=tools,
|
| 20 |
+
add_generation_prompt=True,
|
| 21 |
+
tokenize=True,
|
| 22 |
+
return_tensors="pt"
|
| 23 |
+
).to(model.device)
|
| 24 |
+
|
| 25 |
+
outputs = model.generate(inputs)
|
| 26 |
+
print(tokenizer.decode(outputs[0]))
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
ERROR:
|
| 30 |
+
Traceback (most recent call last):
|
| 31 |
+
File "/tmp/HuggingFaceTB_SmolLM3-3B_6PCxFT7.py", line 30, in <module>
|
| 32 |
+
inputs = tokenizer.apply_chat_template(
|
| 33 |
+
^^^^^^^^^
|
| 34 |
+
NameError: name 'tokenizer' is not defined
|