-
Notifications
You must be signed in to change notification settings - Fork 108
[evals] Add raw web/markup/image-text PPL registration helper #5084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dlwh
wants to merge
2
commits into
main
Choose a base branch
from
claude/issue-5056-20260422-1858
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+61
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Copyright The Marin Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """ | ||
| Registry helpers for raw web, markup, and image-text perplexity-gap slices. | ||
| """ | ||
|
|
||
| import os | ||
| from collections.abc import Mapping | ||
|
|
||
| from marin.evaluation.perplexity_gap import RawTextEvaluationDataset | ||
|
|
||
| RAW_WEB_MARKUP_PREFIX = "raw_web_markup" | ||
|
|
||
| ACTIVE_RAW_WEB_MARKUP_DATASETS: dict[str, RawTextEvaluationDataset] = {} | ||
|
|
||
|
|
||
| def prefixed_raw_web_markup_validation_sets( | ||
| datasets: Mapping[str, RawTextEvaluationDataset], | ||
| ) -> dict[str, RawTextEvaluationDataset]: | ||
| """Prefix raw-web-markup slice names with ``raw_web_markup/``.""" | ||
| return {os.path.join(RAW_WEB_MARKUP_PREFIX, slice_name): dataset for slice_name, dataset in datasets.items()} | ||
|
|
||
|
|
||
| def raw_web_markup_raw_validation_sets() -> dict[str, RawTextEvaluationDataset]: | ||
| """Raw web/markup evaluation slices keyed by ``raw_web_markup/<slice>``.""" | ||
| return prefixed_raw_web_markup_validation_sets(ACTIVE_RAW_WEB_MARKUP_DATASETS) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Copyright The Marin Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import os | ||
|
|
||
| from experiments import exp5056_raw_web_markup_ppl as raw_web_markup | ||
| from marin.evaluation.perplexity_gap import RawTextEvaluationDataset | ||
|
|
||
|
|
||
| def test_prefixed_raw_web_markup_validation_sets_prefixes_each_slice() -> None: | ||
| warc = RawTextEvaluationDataset(input_path="raw/common_crawl/warc.jsonl.gz") | ||
| wat = RawTextEvaluationDataset(input_path="raw/common_crawl/wat.jsonl.gz") | ||
|
|
||
| prefixed = raw_web_markup.prefixed_raw_web_markup_validation_sets( | ||
| { | ||
| "cc_warc_html": warc, | ||
| "cc_wat_json": wat, | ||
| } | ||
| ) | ||
|
|
||
| assert prefixed == { | ||
| os.path.join(raw_web_markup.RAW_WEB_MARKUP_PREFIX, "cc_warc_html"): warc, | ||
| os.path.join(raw_web_markup.RAW_WEB_MARKUP_PREFIX, "cc_wat_json"): wat, | ||
| } | ||
|
|
||
|
|
||
| def test_raw_web_markup_raw_validation_sets_reads_active_registry(monkeypatch) -> None: | ||
| svg = RawTextEvaluationDataset(input_path="raw/svg_stack/svg.xml.jsonl.gz") | ||
|
|
||
| monkeypatch.setattr(raw_web_markup, "ACTIVE_RAW_WEB_MARKUP_DATASETS", {"svg_xml": svg}) | ||
|
|
||
| assert raw_web_markup.raw_web_markup_raw_validation_sets() == { | ||
| os.path.join(raw_web_markup.RAW_WEB_MARKUP_PREFIX, "svg_xml"): svg | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 Docstring references tracking issues that will rot.
CLAUDE.md:
This docstring opens with
#5056: …/Parent: #5005, then refers back to "#5056 design review", "tracked in #5056", and "follow-up PRs". Once those issues are closed or renumbered, the docstring becomes misleading.A module docstring should describe what the module is in the current codebase (one or two sentences about surface-preserving PPL slices, the prefix convention, and where the dataset values come from). Targets and rationale belong in the issue, not here.