Fix TypeError in real_toxicity_prompts due to None choices
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning, testing-qa
Research direction
Start with the real_toxicity_prompts task initialization and the Pipeline.evaluate() reproduction described in the issue, then trace how Doc fields reach get_golds. Confirm the task initializes choices and gold_index as empty lists and rerun the provided pipeline to verify evaluation completes without the TypeError.
Written by the indexing model from the issue text.
Description
Describe the bug
The real_toxicity_prompts evaluation fails with a TypeError because choices and gold_index are initialized to None in the Doc object. Internal Lighteval logic (e.g. get_golds) expects these fields to be iterable (lists) even for purely generative tasks without predefined choices.
To Reproduce
task = "real_toxicity_prompts|5"
pipeline = Pipeline(
tasks=task,
pipeline_parameters=pipeline_params,
evaluation_tracker=evaluation_tracker,
model_config=model_config,
)
pipeline.evaluate()
pipeline.save_and_push_results()
pipeline.show_results()
140 # We init tasks first to fail fast if one is badly defined
141 self._init_random_seeds()
--> 142 self._init_tasks_and_requests(tasks=tasks)
144 self.model_config = model_config
145 self.accelerator, self.parallel_context = self._init_parallelism_manager()
...
221 for gold_ix in gold_indices:
--> 222 golds.extend(as_list(self.choices[gold_ix]))
223 return golds
TypeError: 'NoneType' object is not subscriptable
Expected behavior
choices and gold_index should be initialized to empty lists [] instead of None.
Version info
- OS: mac
- Lighteval version: main (local development)
- Dominant language
- Python
- Stars
- 2.5k
- Forks
- 557
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from huggingface/lighteval
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
huggingface/lighteval#1384 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/lighteval#1375 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
huggingface/lighteval#1365 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 88/100
huggingface/lighteval#1346 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
huggingface/lighteval#1330 · 1 comment ·
All issues in huggingface/lighteval
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100