Update README.md
Browse files
README.md
CHANGED
|
@@ -123,18 +123,13 @@ generated_ids = model.generate(
|
|
| 123 |
)
|
| 124 |
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 125 |
|
| 126 |
-
# parsing
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
|
| 134 |
-
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
|
| 135 |
-
|
| 136 |
-
print("thinking content:", thinking_content) # no opening <think> tag
|
| 137 |
-
print("content:", content)
|
| 138 |
|
| 139 |
```
|
| 140 |
|
|
|
|
| 123 |
)
|
| 124 |
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
|
| 125 |
|
| 126 |
+
# parsing output - if you get errors, make sure you update to the latest version of transformers!
|
| 127 |
+
response = tokenizer.parse_response(tokenizer.decode(output_ids))
|
| 128 |
+
|
| 129 |
+
# If any tool calls are present, they will be in response.tool_calls
|
| 130 |
+
# You can continue the chat by simply appending `response` to `messages`.
|
| 131 |
+
print("thinking content:", response.reasoning)
|
| 132 |
+
print("content:", response.content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
|
| 134 |
```
|
| 135 |
|