From ddee1a53c1b6fdb3650cb88beac5578538beeac8 Mon Sep 17 00:00:00 2001 From: DrStranded Date: Thu, 3 Sep 2026 15:58:18 -0400 Subject: [PATCH] Allow overriding the gated Llama-3 tokenizer used for the LLaMa3 prompt style --- lcb_runner/prompts/code_generation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lcb_runner/prompts/code_generation.py b/lcb_runner/prompts/code_generation.py index 22ba3f82..61242cd2 100644 --- a/lcb_runner/prompts/code_generation.py +++ b/lcb_runner/prompts/code_generation.py @@ -1,4 +1,5 @@ import json +import os try: from anthropic import HUMAN_PROMPT, AI_PROMPT @@ -264,8 +265,13 @@ def format_prompt_generation( ] from transformers import AutoTokenizer + # The tokenizer is only used to render the Llama 3 chat template. The default repo is gated, so any + # Llama 3 family checkpoint the user can access (same chat template) may be substituted via + # LCB_LLAMA3_TOKENIZER. tokenizer = AutoTokenizer.from_pretrained( - "meta-llama/Meta-Llama-3-8B-Instruct", padding_side="left", use_fast=False + os.environ.get("LCB_LLAMA3_TOKENIZER", "meta-llama/Meta-Llama-3-8B-Instruct"), + padding_side="left", + use_fast=False, ) return tokenizer.apply_chat_template( chat_messages,