Skip to content

armgit / sie

Public Imported from GitHub
0

Open-source inference server and production cluster for all the models your agent needs.

fix(models): put Qwen3Guard's stream interval on both profiles once (#687)

svonava9fb03abdb504
diff --git a/packages/sie_server/models/Qwen__Qwen3Guard-Gen-4B.yaml b/packages/sie_server/models/Qwen__Qwen3Guard-Gen-4B.yaml
index 84c82cead..bc22b04a2 100644
--- a/packages/sie_server/models/Qwen__Qwen3Guard-Gen-4B.yaml
+++ b/packages/sie_server/models/Qwen__Qwen3Guard-Gen-4B.yaml
@@ -62,9 +62,6 @@ profiles:
loadtime:
mem_fraction_static: 0.85
served_model_name: Qwen/Qwen3Guard-Gen-4B
- extra_launch_args:
- - --stream-interval
- - "16"
# Stream every 16 decode steps instead of every step. The verdict is
# about ten tokens, so a streaming caller gets it in one event after
# the first token. Each streamed event costs the worker CPU, and the
@@ -91,6 +88,10 @@ profiles:
loadtime:
mem_fraction_static: 0.85
served_model_name: Qwen/Qwen3Guard-Gen-4B
+ # Same streaming cadence as the default profile.
+ extra_launch_args:
+ - --stream-interval
+ - "16"
runtime:
first_chunk_timeout_s: 30
inter_chunk_timeout_s: 10
diff --git a/packages/sie_server/tests/config/test_model_yaml_unique_keys.py b/packages/sie_server/tests/config/test_model_yaml_unique_keys.py
new file mode 100644
index 000000000..70325a73b
--- /dev/null
+++ b/packages/sie_server/tests/config/test_model_yaml_unique_keys.py
@@ -0,0 +1,35 @@
+from __future__ import annotations
+
+from pathlib import Path
+
+import pytest
+import yaml
+
+MODELS_DIR = Path(__file__).resolve().parents[2] / "models"
+
+
+class _UniqueKeyLoader(yaml.SafeLoader):
+ """SafeLoader that refuses a mapping key repeated in the same mapping.
+
+ PyYAML keeps the last value of a repeated key without complaint, so a
+ duplicated block can silently hide an edit. Stricter consumers of these
+ files reject the duplicate outright.
+ """
+
+
+def _construct_unique_mapping(loader: _UniqueKeyLoader, node: yaml.MappingNode, deep: bool = False) -> dict:
+ seen: set[object] = set()
+ for key_node, _ in node.value:
+ key = loader.construct_object(key_node, deep=deep)
+ if key in seen:
+ raise yaml.constructor.ConstructorError(None, None, f"duplicate key {key!r}", key_node.start_mark)
+ seen.add(key)
+ return loader.construct_mapping(node, deep=deep)
+
+
+_UniqueKeyLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, _construct_unique_mapping)
+
+
[email protected]("path", sorted(MODELS_DIR.glob("*.yaml")), ids=lambda path: path.name)
+def test_model_yaml_has_no_duplicate_keys(path: Path) -> None:
+ yaml.load(path.read_text(encoding="utf-8"), Loader=_UniqueKeyLoader) # noqa: S506