Skip to content

feat(deps): add rouge extra for ROUGE scoring deps - #506

Open
anandhu-eng wants to merge 1 commit into
mainfrom
feat/rouge-scoring-deps
Open

anandhu-eng wants to merge 1 commit into
mainfrom
feat/rouge-scoring-deps

Conversation

@anandhu-eng

Copy link
Copy Markdown
Contributor

Problem

RougeScorer (eval_method: "rouge") lazily imports nltk, evaluate and rouge_score and raises an ImportError telling users to install them — but no extra ever declared them. The three shipped Llama configs using eval_method: "rouge" fail at scorer construction on a stock install, and the only install instructions lived in examples/05_Llama_Examples/README.md.

Change

  • New rouge extra declaring nltk==3.10.3, evaluate==0.4.6, rouge-score==0.1.2.
  • test extra inherits it via inference-endpoint[rouge] — same self-reference pattern as inference-endpoint[sql] — so CI covers the import surface with no extra job.

Resolution is clean: 4 new packages, evaluate pulls the already-pinned datasets==5.0.1, and no existing pin moves. Unlike bfcl, no [tool.uv].conflicts fork is needed.

Verified

  • uv lock adds only absl-py, evaluate, nltk, rouge-score; no version changes to existing packages.
  • uv sync --frozen --extra rouge succeeds; all three import at the pinned versions.
  • The lazy-import guard in evaluation/scoring.py now resolves (_evaluate/_nltk non-None), so the ImportError path is no longer hit.

Note

Installing the packages is not sufficient for an offline image: nltk needs the punkt/punkt_tab corpora and evaluate.load("rouge") fetches its metric script from the HF Hub. Prefetching both is handled separately in Dockerfile.dev.

🤖 Generated with Claude Code

`RougeScorer` (eval_method: "rouge") lazily imports nltk, evaluate and
rouge_score and raises ImportError telling users to pip install them, but
no extra ever declared them. The three shipped Llama configs that use
eval_method: "rouge" therefore fail at scorer construction on a stock
install; the only instructions lived in examples/05_Llama_Examples/README.md.

Declare them in a new `rouge` extra and have the `test` extra inherit it
(same self-reference pattern as `inference-endpoint[sql]`), so CI covers
the import surface with no extra job. Resolution is clean: 4 new packages,
`evaluate` pulls the already-pinned datasets==5.0.1, and no existing pin
moves - so unlike bfcl this needs no [tool.uv].conflicts fork.

Not self-contained at runtime: nltk needs the punkt/punkt_tab corpora and
evaluate.load("rouge") fetches its metric script from the HF Hub. Offline
images must prefetch both - handled separately in Dockerfile.dev.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@anandhu-eng
anandhu-eng requested a review from a team September 15, 2026 11:41
@github-actions github-actions Bot added the size/normal PR Review Policy: <=500 non-test lines & <=20 files label Sep 15, 2026
@github-actions

Copy link
Copy Markdown

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

@attafosu attafosu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@arekay-nv arekay-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

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.

3 participants