dataset: split `LeechDataset` into a frozen `TensorCorpus` and an augmenting dataset; block-only twins; batched cross-layer augmentation

オープン
#285 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
8/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python, pytorch

調査の方向性

Start with src/leech/dataset.py, where LeechDataset spans lines 510-1941, and the row/block twin pairs listed in the issue. Read tests/test_dataset_streaming.py::TestBlockFillParity and tests/test_backend_parity.py to see what is currently held equal. Done means TensorCorpus and LeechDataset are split with no external _private access, the parity tests become golden fixtures, and the existing training-equivalence tests pass unchanged.

索引モデルが issue の本文から書いたものです。

説明

enhancement review-2026-09

Tier P3 · effort L · from the 2026-09-13 review (training F6, F7; models F9)

LeechDataset (src/leech/dataset.py:510-1941, 1,430 lines; __init__ 369
lines, 21 parameters, 22 fields) is a corpus loader (_ArrayStream,
_TensorFill, row and block fill, CSR expansion, the encoding-coverage
decision), a tensor store, and an augmenter. External code reaches into its
privates: resolve_val_dataloader_workers reads _signals_tensor
(dataset.py:2064), train_model reads train_dataset.chunks[0], benchmark
iterates dataset.chunks. model_type is only used to look up two
hand-maintained name sets. Four rules exist as row/block twins held bit-equal
by tests/test_dataset_streaming.py::TestBlockFillParity:
_prepare_signal/_prepare_signals_block (1415/1267),
_prepare_features/_prepare_features_block (1489/1314),
_encode_sequence/_encode_sequences_block (1665/1253),
_apply_augmentation/_apply_augmentation_batch (1539/1904). Enabling
--augment-shift-max-bases or --augment-time-mask-bases disables
__getitems__ entirely (dataset.py:1856-1857), the measured 9× cliff.
append_dwell_template_channels (dataset.py:186-229) is a Python double
loop with no test and no Rust counterpart.

Acceptance criteria
  • TensorCorpus (frozen: one contiguous tensor per field, a metadata ChunkTable, effective_seq_encoding, is_contiguous), built by TensorCorpus.from_npz(...) / .from_chunks(...); LeechDataset(corpus, augment: AugmentConfig | None, *, needs_features, wide_features) only indexes and augments. No external module reads a _private attribute of either (test with a grep-based assertion or __slots__).
  • The block form is the implementation; the row form is block(x[None])[0]; TestBlockFillParity becomes golden-fixture tests (saved expected tensors), so the reference is data, not a second implementation. _block_fill_supported shrinks accordingly.
  • Cross-layer shift and time mask draw (B,) parameters and apply with gather/mask tensors on the batched path; __getitems__ is never disabled by an augmentation.
  • append_dwell_template_channels is vectorised and tested, and tests/test_backend_parity.py notes it as Python-only (or it gains a Rust twin).
  • The fork-shares-contiguous-buffers invariant and the numpy-gather rule are preserved and asserted by the existing tests; peak RSS at load on the fixture is unchanged or lower (record it).
Non-goals
  • Changing any tensor value: test_train_epoch_matches_host_side_reference and the streaming parity tests must pass unchanged.
主要言語
Python
スター
0
フォーク
0
平均マージ
11時間 17分
マージ済み PR(30日)
23

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rnabioco/leech のほかの issue

rnabioco/leech の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。