Skip to content

feat(docker): provision ROUGE scorer deps and corpora in dev image - #507

Open
anandhu-eng wants to merge 1 commit into
arekay/push_image_workflowfrom
feat/rouge-provision-dockerfile
Open

anandhu-eng wants to merge 1 commit into
arekay/push_image_workflowfrom
feat/rouge-provision-dockerfile

Conversation

@anandhu-eng

Copy link
Copy Markdown
Contributor

Depends on #506 (the rouge extra). Merge that first, or uv sync --extra rouge fails here. Targets arekay/push_image_workflow, not main.

Change

  • Install the rouge extra in both uv sync layers, so the published image can run eval_method: "rouge". Declared explicitly rather than inherited from test — ROUGE is a runtime capability of the image and shouldn't depend on a test-only extra.
  • New PROVISION_ROUGE=1 block prefetching the scorer's runtime data, matching how PROVISION_DSR1 / PROVISION_VBENCH already make their evaluators self-contained.

Installing the packages isn't enough on its own: nltk.sent_tokenize needs the punkt/punkt_tab corpora and evaluate.load("rouge") fetches its metric script from the HF Hub. The block prefetches both, then asserts the corpora resolve — a silent download failure fails the build rather than the benchmark.

Two deliberate choices

Caches stay in their defaults (~/nltk_data, ~/.cache/huggingface) rather than /opt via NLTK_DATA/HF_HOME. HF_HOME is global at runtime, so repointing it would orphan whatever the DSR1/VBench stages already cached under the default path.

Placed after VBench, before LABEL — editing it rebuilds neither the heavy evaluator stages above nor anything but image config below.

Verified

A full build of this file isn't possible until #506 merges, so the block was validated in an isolated python:3.12.11-slim probe image running as a non-root user with the identical commands:

  • Prefetch succeeds as non-root; rouge metric cached + punkt corpora ok.
  • docker run --network=none computes rougeL from the baked cache — the offline claim, confirmed end to end.
  • PROVISION_ROUGE=0 correctly skips the block.

Probe images were removed afterward. The prefetch commands were also run against the real rouge-synced venv, including an offline replay.

🤖 Generated with Claude Code

Install the `rouge` extra in both uv sync layers and prefetch the scorer's
runtime data, so a pushed image can run `eval_method: "rouge"` with no
network - matching how PROVISION_DSR1 / PROVISION_VBENCH already make the
DeepSeek-R1 and VBench evaluators self-contained.

The extra is declared explicitly rather than inherited from `test`, since
ROUGE is a runtime capability of the published image and should not depend
on a test-only extra to supply it.

Installing the packages is not enough on its own: nltk.sent_tokenize needs
the punkt/punkt_tab corpora and evaluate.load("rouge") fetches its metric
script from the HF Hub. A new PROVISION_ROUGE=1 block prefetches both and
then asserts the corpora resolve, so a silent download failure fails the
build instead of the benchmark.

Both caches land in their default per-user locations (~/nltk_data,
~/.cache/huggingface). Deliberately not redirected to /opt via
NLTK_DATA/HF_HOME: HF_HOME is global at runtime, so repointing it would
orphan what the DSR1/VBench stages already cached under the default path.
The block sits after VBench and before the LABEL layer, so editing it
rebuilds neither the heavy evaluator stages nor anything but image config.

Requires the `rouge` extra from #506 - merge that first, or `uv sync
--extra rouge` fails here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@anandhu-eng
anandhu-eng requested a review from a team as a code owner September 15, 2026 11:49
@github-actions

Copy link
Copy Markdown

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@github-actions github-actions Bot added the size/normal PR Review Policy: <=500 non-test lines & <=20 files label Sep 15, 2026
@arekay-nv
arekay-nv requested a review from attafosu September 16, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/normal PR Review Policy: <=500 non-test lines & <=20 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants