Skip to content

refactor(connectors): add PrecomputedSplitter for split files - #793

Open
karhu wants to merge 5 commits into
feature/m4-caption-connectorfrom
chore/shared-frozen-splits
Open

karhu wants to merge 5 commits into
feature/m4-caption-connectorfrom
chore/shared-frozen-splits

Conversation

@karhu

@karhu karhu commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

sleep_cot and m4_caption each had their own copy of a precomputed split: the validation and test samples that a script wrote to a file, with the digest of the source file that the split was made from.

PrecomputedSplitter in timenet_connectors.splitting now owns this. It is a Splitter, like StratifiedSplitter, and returns DatasetSplits. PrecomputedSplitter.from_file reads plain JSON or JSON compressed with xz, and checks the split against the pinned source digest. The file names a sample by its position, or by the key that a key function returns. The file format does not change.

Both connectors use it and loop over the splits like tsqa. So their records come split by split, each split in source order. The error messages of sleep_cot for a bad split file change wording. docs/connectors.md describes the new splitter.

The tests for a bad split file are now in test_precomputed_splits.py. Each connector keeps one test, which proves that the connector checks the split file against its own pinned digest.

The real split files of both connectors give the same splits as before.

@karhu
karhu added this pull request to stack #791 November 17, 2026 18:52
@karhu karhu added the area:connectors Changes packages/timenet-connectors label Nov 17, 2026
@karhu
karhu force-pushed the chore/shared-frozen-splits branch 5 times, most recently from 1e4fe29 to 197c245 Compare November 17, 2026 23:58
@karhu karhu changed the title refactor(connectors): share one frozen-split type refactor(connectors): share one precomputed-split type Nov 18, 2026
@karhu
karhu marked this pull request as ready for review November 18, 2026 00:17
@karhu
karhu requested review from RealLast and TimoStoff November 18, 2026 00:17
@karhu
karhu force-pushed the chore/shared-frozen-splits branch from 00bbd4e to 061aa8d Compare November 18, 2026 01:04
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ CI checks passed

Check Status
Quick checks ✅ Passed
Tests (Python 3.13) ✅ Passed
Tests (Python 3.11) ✅ Passed

Updated for 939fd8c · run #8661

@karhu
karhu force-pushed the chore/shared-frozen-splits branch 2 times, most recently from e2d1e84 to 74cdde6 Compare November 18, 2026 01:23

@RealLast RealLast left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@TimoStoff good to get your eyes on this one please

Imo this can be consolidated with existing split functionality, a predefined split is a splitter derived from common base class

@karhu
karhu force-pushed the chore/shared-frozen-splits branch 4 times, most recently from e584050 to 16279e8 Compare November 20, 2026 17:30
sleep-cot and m4-caption each had their own copy of a frozen split:
the validation and test samples that a script wrote to a file, with
the digest of the source file that the split was made from.

FrozenSplits in timenet_connectors.splitting now owns this. It names
samples by row position or by source id, reads plain JSON or JSON
compressed with xz, and takes the pinned source digest as an argument.
Both connectors use it. The real split files of both connectors give
the same splits as before.
@karhu
karhu force-pushed the chore/shared-frozen-splits branch from 16279e8 to 5f537da Compare November 20, 2026 17:31
K becomes SampleKeyT, like RowT of the readers. The docstring no longer
says that the split comes from a library the connector should not pin.
It now says that the split depends on a library version, so that making
it again at build time could change it.
PrecomputedSplits becomes PrecomputedSplitter, a Splitter like
StratifiedSplitter. PrecomputedSplitter.from_file reads the split file
and checks it against the pinned source digest. split() returns
DatasetSplits. The file names a sample by its position, or by the key
that the key function returns. The file format does not change.

sleep_cot and m4_caption now loop over the DatasetSplits, like tsqa. So
their records come split by split, each split in source order. M4 keeps
one series class, M4CaptionSeries, and the reader gets split_series. The
connector docs describe the new splitter.
@karhu karhu changed the title refactor(connectors): share one precomputed-split type refactor(connectors): add PrecomputedSplitter for split files Nov 20, 2026

karhu commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Agreed, done. PrecomputedSplits is now PrecomputedSplitter, a Splitter like StratifiedSplitter, and returns DatasetSplits.

@karhu
karhu requested a review from RealLast November 20, 2026 20:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:connectors Changes packages/timenet-connectors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants