Skip to content

Avoid decoding unused features for single-column evaluator inputs - #907

Open
snygginghani wants to merge 1 commit into
huggingface:mainfrom
snygginghani:perf/evaluator-project-single-input-column
Open

snygginghani wants to merge 1 commit into
huggingface:mainfrom
snygginghani:perf/evaluator-project-single-input-column

Conversation

@snygginghani

Copy link
Copy Markdown

DatasetColumn reads a full row before returning the selected value. On a multimodal dataset, an evaluation using only the text column still decodes unrelated images or audio. An unusable file in an unrelated media column can also abort a text-only evaluation.

Project the unformatted dataset view to the selected column before reading rows. Formatted or transformed views retain the existing path because a transform can depend on other columns.

On an Intel Core i5-12400F with four PyTorch CPU threads, Transformers 4.57.6, and Datasets 2.21.0, I evaluated the first 32 actual ChartQA test images and questions repeated four times. The public text-generation evaluator used hf-internal-testing/tiny-random-gpt2, batch size 8, two new tokens, and the local word_count metric. Over eight alternating runs, adapter iteration went from 216.28 ms to 3.31 ms and the complete evaluator went from 569.11 ms to 321.16 ms. Inputs and metrics matched exactly (1,392 total words and 124 unique words).

Two focused tests cover an unused unreadable image and a custom transform that reads a second column. Black, isort, flake8 and git diff --check passed.

Prepared with AI assistance.

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