Skip to content

refactor: extract shared task utilities to reduce cross-task code duplication#1122

Merged
Luodian merged 3 commits into
dev-v0d7from
feat/task-redundancy-dedup
Feb 21, 2026
Merged

refactor: extract shared task utilities to reduce cross-task code duplication#1122
Luodian merged 3 commits into
dev-v0d7from
feat/task-redundancy-dedup

Conversation

@Luodian
Copy link
Copy Markdown
Contributor

@Luodian Luodian commented Feb 21, 2026

Summary

  • Extract default_template_yaml loader to shared _task_utils/default_template_yaml.py (11 task utils -> 1 shared, 9 lines)
  • Extract MMMU MCQ parsing to shared _task_utils/mmmu_mcq_utils.py (8 task utils -> 1 shared, 274 lines)
  • Extract ASR WER computation to shared tasks/asr_wer_utils.py (7 task utils -> 1 shared, 163 lines)

Impact

  • 29 files changed, net -839 lines of duplicated code removed
  • All deduped tasks import from shared utilities instead of maintaining their own copies
  • Zero behavior change - all extraction is pure refactor

Dedup Lines

Shared Utility Consumers Lines Saved
_task_utils/default_template_yaml.py air_bench, blink, egoschema, erqa, illusionbench, mix_evals (x2), perceptiontest (x2), where2place, worldqa ~150
_task_utils/mmmu_mcq_utils.py mmmu, mmmu/reasoning, mmmu_pro, mmmu_pro/reasoning, jmmmu, jmmmu_pro, videommmu, mmmu (group_img) ~500
tasks/asr_wer_utils.py common_voice_15, fleurs, gigaspeech, librispeech, open_asr, people_speech, tedlium ~700

Deduplicate the repeated YAML-loading boilerplate (open file, filter
!function lines, yaml.safe_load) across 11 task utils into a single
load_default_template_yaml() in _task_utils/default_template_yaml.py.

Affected tasks: air_bench, blink, egoschema, erqa, illusionbench,
mix_evals/image2text, mix_evals/video2text, perceptiontest/test,
perceptiontest/val, where2place, worldqa.
Consolidate duplicated multi-choice response parsers
(get_multi_choice_info, parse_mmmu_multi_choice_response, and
variants for jmmmu, jmmmu_pro, videommmu) into a single shared
module at _task_utils/mmmu_mcq_utils.py.

Affected tasks: mmmu, mmmu/reasoning, mmmu_pro, mmmu_pro/reasoning,
jmmmu, jmmmu_pro, videommmu, mmmu/utils_group_img.
Consolidate duplicated EvaluationTokenizer, remove_sp, compute_wer,
and normalization helpers across 7 ASR task utils into a single
shared module at tasks/asr_wer_utils.py.

Affected tasks: common_voice_15, fleurs, gigaspeech, librispeech,
open_asr, people_speech, tedlium.
@Luodian Luodian merged commit f3ee423 into dev-v0d7 Feb 21, 2026
2 checks passed
@Luodian Luodian deleted the feat/task-redundancy-dedup branch February 23, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant