Larger context and WiP fix to prefix handling

This commit is contained in:
2025-05-22 20:24:29 +00:00
parent 41079c8ba1
commit ab349993ba
2 changed files with 4 additions and 8 deletions

View File

@@ -25,7 +25,7 @@ def main():
parser.add_argument( parser.add_argument(
'--token-limit', '--token-limit',
type=int, type=int,
default=os.getenv('SIA_GEMMA_TOKEN_LIMIT', 4096), default=os.getenv('SIA_GEMMA_TOKEN_LIMIT', 10000),
help='Token limit (default: 4096, env: SIA_GEMMA_TOKEN_LIMIT)' help='Token limit (default: 4096, env: SIA_GEMMA_TOKEN_LIMIT)'
) )

View File

@@ -60,17 +60,13 @@ class GemmaLlmEngine(LlmEngine):
"prefix": True, "prefix": True,
}, },
] if prefix else [ ] if prefix else [
{
"role": "system",
"content": system,
},
{ {
"role": "user", "role": "user",
"content": context, "content": f"{system}\n\n--- Context ---\n{context}",
}, }
] ]
return self._tokenizer.apply_chat_template( return self._tokenizer.apply_chat_template(
messages, messages,
tokenize=False, tokenize=False,
add_generation_prompt=True add_generation_prompt=prefix is None or len(prefix) == 0
).removeprefix("<bos>") ).removeprefix("<bos>")