Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lcb_runner/lm_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class LMStyle(Enum):
QwQ = "QwQ"
LLaMa3 = "LLaMa3"
DeepSeekR1 = "DeepSeekR1"
GraniteInstruct = "GraniteInstruct"

TogetherAI = "TogetherAI"

Expand Down Expand Up @@ -861,6 +862,21 @@ def to_dict(self) -> dict:
datetime(2024, 4, 1),
"https://huggingface.co/agentica-org/DeepCoder-14B-Preview",
),
## Granite 3.3 Instruct (2B and 8B)
LanguageModel(
"ibm-granite/granite-3.3-2b-instruct",
"Granite-3.3-2B-Ins",
LMStyle.GraniteInstruct,
datetime(2025, 4, 16),
"https://huggingface.co/ibm-granite/granite-3.3-2b-instruct",
),
LanguageModel(
"ibm-granite/granite-3.3-8b-instruct",
"Granite-3.3-8B-Ins",
LMStyle.GraniteInstruct,
datetime(2025, 4, 16),
"https://huggingface.co/ibm-granite/granite-3.3-8b-instruct",
),
]

LanguageModelStore: dict[str, LanguageModel] = {
Expand Down
25 changes: 25 additions & 0 deletions lcb_runner/prompts/code_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,31 @@ def format_prompt_generation(
prompt += f"{get_deepseek_r1_question_template_answer(question)}"
return prompt

if LanguageModelStyle == LMStyle.GraniteInstruct:
chat_messages = [
{
"role": "system",
"content": PromptConstants.SYSTEM_MESSAGE_GENERIC,
},
{
"role": "user",
"content": get_generic_question_template_answer(question),
},
]
from transformers import AutoTokenizer

# Granite 3.x instruct models share one chat template; only the template is used here.
tokenizer = AutoTokenizer.from_pretrained(
"ibm-granite/granite-3.3-2b-instruct", padding_side="left"
)
return tokenizer.apply_chat_template(
chat_messages,
tokenize=False,
add_generation_prompt=True,
truncation=False,
padding=False,
)

if LanguageModelStyle == LMStyle.GenericBase:
prompt = get_base_model_question_template_answer(question)
return prompt
Expand Down