fix: enable qwen thinking with larger token budget
Browse files- .gitignore +4 -1
- model_runtime.py +2 -2
- tests/test_model_runtime.py +2 -2
.gitignore
CHANGED
|
@@ -178,4 +178,7 @@ cython_debug/
|
|
| 178 |
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
| 179 |
# refer to https://docs.cursor.com/context/ignore-files
|
| 180 |
.cursorignore
|
| 181 |
-
.cursorindexingignore
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
| 179 |
# refer to https://docs.cursor.com/context/ignore-files
|
| 180 |
.cursorignore
|
| 181 |
+
.cursorindexingignore
|
| 182 |
+
|
| 183 |
+
# macOS
|
| 184 |
+
.DS_Store
|
model_runtime.py
CHANGED
|
@@ -21,7 +21,7 @@ from schemas import AnalysisResult
|
|
| 21 |
|
| 22 |
PRIMARY_MODEL_ID = "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16"
|
| 23 |
QUICK_MODEL_ID = "Qwen/Qwen3.5-9B"
|
| 24 |
-
MODEL_MAX_NEW_TOKENS =
|
| 25 |
|
| 26 |
MODEL_CHOICES = {
|
| 27 |
"qwen": {
|
|
@@ -164,7 +164,7 @@ def _chat_template_kwargs(model_id: str) -> dict[str, Any]:
|
|
| 164 |
"""Model-specific chat-template controls."""
|
| 165 |
|
| 166 |
if model_id.startswith("Qwen/"):
|
| 167 |
-
return {"enable_thinking":
|
| 168 |
return {}
|
| 169 |
|
| 170 |
|
|
|
|
| 21 |
|
| 22 |
PRIMARY_MODEL_ID = "nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16"
|
| 23 |
QUICK_MODEL_ID = "Qwen/Qwen3.5-9B"
|
| 24 |
+
MODEL_MAX_NEW_TOKENS = 8192
|
| 25 |
|
| 26 |
MODEL_CHOICES = {
|
| 27 |
"qwen": {
|
|
|
|
| 164 |
"""Model-specific chat-template controls."""
|
| 165 |
|
| 166 |
if model_id.startswith("Qwen/"):
|
| 167 |
+
return {"enable_thinking": True}
|
| 168 |
return {}
|
| 169 |
|
| 170 |
|
tests/test_model_runtime.py
CHANGED
|
@@ -114,8 +114,8 @@ class ModelRuntimeTests(unittest.TestCase):
|
|
| 114 |
self.assertEqual(input_ids.device, "cuda")
|
| 115 |
self.assertEqual(attention_mask.device, "cuda")
|
| 116 |
|
| 117 |
-
def
|
| 118 |
-
self.assertEqual(_chat_template_kwargs(QUICK_MODEL_ID), {"enable_thinking":
|
| 119 |
self.assertEqual(_chat_template_kwargs(PRIMARY_MODEL_ID), {})
|
| 120 |
|
| 121 |
def test_analyzer_records_unknown_engine_note(self) -> None:
|
|
|
|
| 114 |
self.assertEqual(input_ids.device, "cuda")
|
| 115 |
self.assertEqual(attention_mask.device, "cuda")
|
| 116 |
|
| 117 |
+
def test_qwen_chat_template_enables_thinking(self) -> None:
|
| 118 |
+
self.assertEqual(_chat_template_kwargs(QUICK_MODEL_ID), {"enable_thinking": True})
|
| 119 |
self.assertEqual(_chat_template_kwargs(PRIMARY_MODEL_ID), {})
|
| 120 |
|
| 121 |
def test_analyzer_records_unknown_engine_note(self) -> None:
|