Repository navigation
Conversation
CIDEr-D weighs n-grams by document frequency over the whole split, so a scorer may now rate a split's rows together (Scorer.corpus), which the evaluator does on rank 0 once the ranks' records are merged. Each caption row records its own CIDEr-D under the split's weights, and the task's metric is their mean. Texts are split on whitespace as written.
The case and punctuation test had no capital letter, so lowercasing the texts before the whitespace split left it green, and only the fixture row caught that. A prediction "A yak" against the reference "a yak" now has to score above 0 and below the exact match.
amazloumi
marked this pull request as ready for review
December 6, 2026 09:31
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ciderscorer (evaluation/scorers.py): CIDEr-D with n-grams of one to four words, sigma 6 and the factor 10, written from its definition (cider_d): n-gram counts weighted by inverse document frequency over the references of the split, a cosine for each n with the prediction's counts clipped to the reference's, a Gaussian penalty on the difference in length, averaged over the references and the four n. No new dependency.yak.is notyak). The standard COCO caption evaluation lowercases and drops punctuation with the PTB tokenizer first, so these numbers differ from its; the docstring and the README say so.Scorergains an optionalcorpus, which rates a split's scored rows together. The evaluator applies it on rank 0 once the ranks' records are merged (score_corpus, beforesummarize): each caption row's record holds its own CIDEr-D under the split's weights, and the task's metric is the mean of the rows', as pycocoevalcap's per-image scores average to its corpus score. The metric does not depend on the number of ranks or the batch size, and a row's reference is the oneevaluate_batchscores against (reference(row)for a reader that has one, otherwise the turn's answers). As a row is decoded,ciderchecks its inputs as the other text scorers do and scores it alone (0, as in a split of one row), whichscore_corpusthen replaces. No other scorer has acorpus, so their records and metrics are unchanged.configs/eval_tasks.toml:coco-captions(Karpathy val, 5,000 images) andflickr30k(val, 1,014 images) with placeholder paths, both read by thecoco_captionsreader, which asks each image the task's prompt and keeps every non-blank caption of the image as a reference, scored byciderand capped at the recipe's 100 tokens. The prompt is "Provide a short caption for the image.", the one the training mixtures caption with. They come before VQAv2, so the file's header stays true.ciderin the scorer list, the two tasks in the sample file's paragraph, and the corpus step in the evaluator section and in the note on adding a scorer.Testing
All at
2bf0d2c8, on maind4e9b7ce; Python 3.12.11 and 3.14.10, torch 2.14.1+cu130, transformers 5.5.0. No file underkempnerforge/,tests/ordocs/changes, so the core tiers do not apply.Cider()at its defaults (n=4, sigma=6.0), given the raw strings with no tokenizer, on two splits of fixed captions, stored with the captions intests/evaluation/cider_pycocoevalcap_scores.json; the tests do not import pycocoevalcap. The first split's 11 rows cover case and punctuation, a repeated n-gram (clipping), n-grams in no reference, a one-word and a long prediction (the length penalty), one, two, three and five references, an empty prediction, runs of whitespace, a one-word reference and a prediction equal to a reference; the second split is one of those rows alone.cider_dmatches every row and both splits to a relative 1e-12 (the largest difference measured is 4.4e-16, on 3.12 and 3.14).evaluate_checkpointrecords each row's CIDEr-D under the split's weights and reports their mean; the shards of 2 and 3 ranks, merged and scored on rank 0, give the same records and metrics as one rank, and two gloo ranks write the same files as one process, byte for byte.ruff check .andruff format --check .: cleanpyright examples/image_understanding/evaluation: 0 errorsexamples/image_understanding/tests(--timeout=60): 1,613 passed, 0 failed, 0 skipped, on 3.12 and on 3.14examples/vlm/testswithout the eval integration tier (--timeout=60): 407 passed on each;examples/assembled_run/tests: 9 passed on eachevaluation/: all covered (branch coverage, 3.12 and 3.14)test_documented_commands_write_each_override_with_an_equals_sign): passedCloses #647