Skip to content

Commit d38f640

Browse files
authored
[fix] modify the GPT evaluation model (#668)
* [fix] modify the GPT evaluation model * [fix] modify the GPT evaluation model
1 parent 4ca1a52 commit d38f640

File tree

6 files changed

+261
-255
lines changed

6 files changed

+261
-255
lines changed

lmms_eval/models/qwen2_5_vl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ def _collate(x):
195195
split = split[0]
196196
visual_list = [doc_to_visual[0](self.task_dict[task][split][ids]) for ids in doc_id]
197197
gen_kwargs = all_gen_kwargs[0]
198-
198+
199199
# Set default until or update values from gen_kwargs if present
200200
until = gen_kwargs.get("until", [self.tokenizer.decode(self.eot_token_id)])
201-
201+
202202
if isinstance(until, str):
203203
until = [until]
204204
elif not isinstance(until, list):
205205
raise ValueError(f"Expected `gen_kwargs['until']` to be of type Union[str, list], but got {type(until)}")
206-
206+
207207
# Avoid using '\n\n' as a stopper for Qwen2.5VL to prevent truncation, which can lead to incorrect results
208208
until = [item for item in until if item != "\n\n"]
209-
209+
210210
if isinstance(contexts, tuple):
211211
contexts = list(contexts)
212212

lmms_eval/models/vllm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(
5353

5454
# Convert any string arguments that start with { and end with } to dictionaries
5555
for key, value in kwargs.items():
56-
if isinstance(value, str) and value.strip().startswith('{') and value.strip().endswith('}'):
56+
if isinstance(value, str) and value.strip().startswith("{") and value.strip().endswith("}"):
5757
try:
5858
kwargs[key] = json.loads(value)
5959
except json.JSONDecodeError:
@@ -184,7 +184,7 @@ def generate_until(self, requests) -> List[str]:
184184
batched_messages.append(messages)
185185

186186
sampling_params = SamplingParams(**params)
187-
187+
188188
if self.chat_template is not None:
189189
with open(self.chat_template, "r") as f:
190190
chat_template = f.read()

0 commit comments

Comments
 (0)