Shared response buffer backend
This commit is contained in:
@@ -63,7 +63,7 @@ class QwQLlmEngine(LlmEngine):
|
||||
self._logits_processor = None
|
||||
|
||||
|
||||
def infer(self, system_prompt: str, main_context: str, should_stop: Callable[[], bool] = lambda: False) -> Iterator[str]:
|
||||
def infer(self, system_prompt: str, main_context: str, continuation_text: str, should_stop: Callable[[], bool] = lambda: False) -> Iterator[str]:
|
||||
"""
|
||||
Run inference using the system prompt and main context.
|
||||
|
||||
@@ -77,13 +77,14 @@ class QwQLlmEngine(LlmEngine):
|
||||
"""
|
||||
messages = [
|
||||
{"role": "system", "content": system_prompt},
|
||||
{"role": "user", "content": main_context}
|
||||
{"role": "user", "content": main_context},
|
||||
{"role": "assistant", "content": continuation_text},
|
||||
]
|
||||
|
||||
text = self._tokenizer.apply_chat_template(
|
||||
messages,
|
||||
tokenize=False,
|
||||
add_generation_prompt=True,
|
||||
add_generation_prompt=False,
|
||||
)
|
||||
|
||||
streamer = TextIteratorStreamer(
|
||||
|
||||
Reference in New Issue
Block a user