Skip to content

Commit c5a22bf

Browse files
committed
feat(codegen): support model revision
1 parent e25440e commit c5a22bf

File tree

5 files changed

+11
-1
lines changed

5 files changed

+11
-1
lines changed

bigcodebench/generate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def run_codegen(
139139
backend: str = "vllm",
140140
base_url: str = None,
141141
tp: int = 1,
142+
revision: str = "main",
142143
trust_remote_code: bool = False,
143144
tokenizer_name: str = None,
144145
tokenizer_legacy: bool = False,
@@ -173,14 +174,15 @@ def run_codegen(
173174
response_prefix=response_prefix,
174175
base_url=base_url,
175176
tp=tp,
177+
revision=revision,
176178
trust_remote_code=trust_remote_code,
177179
direct_completion=direct_completion,
178180
tokenizer_name=tokenizer_name,
179181
tokenizer_legacy=tokenizer_legacy
180182
)
181183

182184
extra = "-" + subset if subset != "full" else ""
183-
identifier = model.replace("/", "--") + f"--bigcodebench{extra}-{split}--{backend}-{temperature}-{n_samples}-sanitized_calibrated.jsonl"
185+
identifier = model.replace("/", "--") + f"--{revision}--bigcodebench{extra}-{split}--{backend}-{temperature}-{n_samples}-sanitized_calibrated.jsonl"
184186

185187
target_path = os.path.join(root, identifier)
186188

bigcodebench/provider/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def make_model(
1212
# instruction model only
1313
instruction_prefix: str = None,
1414
response_prefix: str = None,
15+
# vllm and hf only
16+
revision: str = "main",
1517
# vllm only
1618
tp: int = 1,
1719
direct_completion: bool = False,
@@ -32,6 +34,7 @@ def make_model(
3234
split=split,
3335
temperature=temperature,
3436
max_new_tokens=max_new_tokens,
37+
revision=revision,
3538
dataset=dataset,
3639
direct_completion=direct_completion,
3740
tp=tp,
@@ -47,6 +50,7 @@ def make_model(
4750
split=split,
4851
temperature=temperature,
4952
max_new_tokens=max_new_tokens,
53+
revision=revision,
5054
dataset=dataset,
5155
direct_completion=direct_completion,
5256
instruction_prefix=instruction_prefix,

bigcodebench/provider/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def __init__(
1212
split: str,
1313
temperature: float = 0.8,
1414
max_new_tokens: int = 1280,
15+
revision: str = "main",
1516
dtype: str = "bfloat16", # default
1617
direct_completion: bool = False,
1718
trust_remote_code: bool = False,
@@ -29,6 +30,7 @@ def __init__(
2930
self.skip_special_tokens = False
3031
self.max_new_tokens = max_new_tokens
3132
self.dtype = dtype
33+
self.revision = revision
3234
self.direct_completion = direct_completion
3335
self.trust_remote_code = trust_remote_code
3436
self.tokenizer_name = tokenizer_name

bigcodebench/provider/hf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def __init__(
2727
"trust_remote_code": self.trust_remote_code,
2828
"torch_dtype": getattr(torch, self.dtype),
2929
"attn_implementation": attn_implementation, # "eager", "flash_attention_2", "sdpa"
30+
"revision": self.revision,
3031
}
3132
self.skip_special_tokens = True
3233

bigcodebench/provider/vllm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def __init__(self, name: str, dataset: str, tp: int, **kwargs) -> None:
1818
"tensor_parallel_size": int(os.getenv("VLLM_N_GPUS", tp)),
1919
"dtype": self.dtype,
2020
"trust_remote_code": self.trust_remote_code,
21+
"revision": self.revision,
2122
}
2223
if self.tokenizer_name is None:
2324
self.tokenizer_name = self.name

0 commit comments

Comments
 (0)