Skip to content
Merged
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
2 changes: 1 addition & 1 deletion tools/who_what_benchmark/whowhatbench/text_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def default_gen_answer(model, tokenizer, prompt, max_new_tokens, crop_question,
else:
prompts_file_path = LONG_PROMPTS_FILE if self.long_prompt else PROMPTS_FILE
data_path = files('whowhatbench.prompts').joinpath(prompts_file_path)
prompt_data = yaml.safe_load(data_path.read_text())
prompt_data = yaml.safe_load(data_path.read_text(encoding='utf-8'))
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While adding explicit encoding is good practice, consider using 'utf-8-sig' encoding instead of 'utf-8' to handle files that may contain a UTF-8 BOM (Byte Order Mark), which is common in Windows environments and could cause YAML parsing issues.

Suggested change
prompt_data = yaml.safe_load(data_path.read_text(encoding='utf-8'))
prompt_data = yaml.safe_load(data_path.read_text(encoding='utf-8-sig'))

Copilot uses AI. Check for mistakes.

data = pd.DataFrame.from_dict(prompt_data[self.language])

prompt_data = data["prompts"]
Expand Down