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

Abierto
#285 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
8/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python, pytorch

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Python
Estrellas
0
Forks
0
Merge medio
11 h 17 min
PR fusionados (30 d)
23

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rnabioco/leech

Todos los issues de rnabioco/leech

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.