Validator works for start

This commit is contained in:
2025-04-07 14:31:56 +00:00
parent 50539f6d03
commit 2e08be4b75
16 changed files with 108 additions and 82 deletions

View File

@@ -29,8 +29,6 @@ class QwQLlmEngine(LlmEngine):
"""
self._temperature = temperature
self._token_limit = token_limit
if xml_schema_text:
self._logits_processor = XmlLogitsProcessor(self._tokenizer, xml_schema_text)
with open('/root/sia/qwq_tokenizer_config.json', 'r') as f:
tokenizer_config = json.load(f)
@@ -62,6 +60,11 @@ class QwQLlmEngine(LlmEngine):
return_full_text=False,
)
if xml_schema_text:
self._logits_processor = XmlLogitsProcessor(self._tokenizer, xml_schema_text)
else:
self._logits_processor = None
def infer(self, system_prompt: str, main_context: str, should_stop: Callable[[], bool] = lambda: False) -> Iterator[str]:
"""
@@ -100,7 +103,7 @@ class QwQLlmEngine(LlmEngine):
}
if self._logits_processor:
generation_kwargs["logits_processor"] = self.logits_processor
generation_kwargs["logits_processor"] = [self._logits_processor]
generation_thread = Thread(
target=self._pipline,