Spaces:
Running on Zero
Running on Zero
feat: improve qwen zerogpu ux
Browse filesCo-authored-by: Codex <noreply@openai.com>
- analyzer.py +3 -1
- tests/test_model_runtime.py +11 -0
analyzer.py
CHANGED
|
@@ -196,9 +196,11 @@ def analyze_trace_file(
|
|
| 196 |
token=hf_token,
|
| 197 |
)
|
| 198 |
except Exception as exc:
|
|
|
|
| 199 |
result.model_notes.append(
|
| 200 |
"Model assist was requested but unavailable: "
|
| 201 |
-
f"{type(exc).__name__}: {
|
|
|
|
| 202 |
)
|
| 203 |
else:
|
| 204 |
result.engine = f"deterministic-codebook + {assist.model_id}"
|
|
|
|
| 196 |
token=hf_token,
|
| 197 |
)
|
| 198 |
except Exception as exc:
|
| 199 |
+
error_message = str(exc).strip().rstrip(".")
|
| 200 |
result.model_notes.append(
|
| 201 |
"Model assist was requested but unavailable: "
|
| 202 |
+
f"{type(exc).__name__}: {error_message}. "
|
| 203 |
+
"Deterministic analysis was returned."
|
| 204 |
)
|
| 205 |
else:
|
| 206 |
result.engine = f"deterministic-codebook + {assist.model_id}"
|
tests/test_model_runtime.py
CHANGED
|
@@ -76,6 +76,17 @@ class ModelRuntimeTests(unittest.TestCase):
|
|
| 76 |
self.assertTrue(result.model_notes)
|
| 77 |
self.assertIn("Unknown analysis engine", result.model_notes[0])
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
def test_analyzer_passes_hf_token_to_model_assist(self) -> None:
|
| 80 |
with patch("analyzer.run_model_assist") as run_model_assist:
|
| 81 |
run_model_assist.return_value = types.SimpleNamespace(
|
|
|
|
| 76 |
self.assertTrue(result.model_notes)
|
| 77 |
self.assertIn("Unknown analysis engine", result.model_notes[0])
|
| 78 |
|
| 79 |
+
def test_analyzer_model_error_note_avoids_double_period(self) -> None:
|
| 80 |
+
with patch("analyzer.run_model_assist", side_effect=ValueError("needs login.")):
|
| 81 |
+
result, _ = analyze_trace_file(
|
| 82 |
+
Path("examples/sample_trace_redacted.jsonl"),
|
| 83 |
+
analysis_engine="qwen",
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
self.assertTrue(result.model_notes)
|
| 87 |
+
self.assertNotIn("..", result.model_notes[0])
|
| 88 |
+
self.assertIn("ValueError: needs login.", result.model_notes[0])
|
| 89 |
+
|
| 90 |
def test_analyzer_passes_hf_token_to_model_assist(self) -> None:
|
| 91 |
with patch("analyzer.run_model_assist") as run_model_assist:
|
| 92 |
run_model_assist.return_value = types.SimpleNamespace(
|