models: port the hand-written cross-attention classes to TOML variants (after the tier decision)

Aperta
#287 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
python, pytorch

Direzione di ricerca

Start with the registry-tiers issue, since it decides which classes survive, then read the shared tail in transformer_dwell.py, resnet_dwell.py and conv_only.py alongside tcn_dwell.toml. Move the surviving architectures into nn.py and the three TOML files, and keep the state_dict keys unchanged. Done means the golden-oracle tests in tests/test_models.py pass against the reference_*.py copies.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement review-2026-09

Tier P3 · effort M · from the 2026-09-13 review (models F1, F2, F10, F11, F15) — depends on the registry-tiers issue; skip any class that is deprecated there

transformer_dwell.py:203-264, resnet_dwell.py:271-326 and
conv_only.py:195-254 implement, line for line, the tcn_dwell.toml tail
(merge → transpose → cross_attn(feat_kv) → add → LayerNorm → pool_linear → softmax pool → classifier, nodes 88-181); only their front ends differ.
ResNetDwell/ConvOnly heads hardcode nn.BatchNorm1d and 512/128 widths
ignoring norm_type. components.SignalBranch / SequenceBranch /
FeatureBranch (components.py:177-364) are one class with three default
kernels. Two latent defects in the classes: TransformerDwell passes one
encoder_layer instance to both nn.TransformerEncoders
(transformer_dwell.py:165-173), so all eight layers start from identical
weights; ResNetDwell's sequence tower reduces 11 positions to length 1 and
upsamples by repeating bins (resnet_dwell.py:127-148, 221-227), so
cross-attention queries carry no positional sequence information.

Acceptance criteria
  • ResNet1D, InceptionBlock, PositionalEncoding and a TransformerEncoder factory are nn.py registry layers; transformer_dwell.toml, resnet_dwell.toml, conv_only.toml declare the surviving architectures with the shared tail. The classes move to tests/reference_*.py as golden oracles with the same state-dict-key, seeded-init and bit-identity tests the TCN/ConvLSTM ports have (tests/test_models.py:715-1032).
  • One ConvBranch(in_channels, conv_channels, kernel_size, norm_type, squeeze_2d=False) with the three names as aliases so state_dict prefixes are unchanged; use_batchnorm / _resolve_norm_type are removed.
  • The transformer layers are independently initialised (factory per layer) and norm_first=True is a variant param; the ResNet sequence tower keeps positional resolution (drop the stem stride/maxpool for that tower) — or both are documented as reference-only behaviour if the classes are deprecated.
  • _MODEL_SPECS shrinks to Remora + SignalCNN.
Non-goals
  • Changing the production TCN family.
Lingua principale
Python
Stelle
0
Fork
0
Merge medio
11h 17m
PR unite (30g)
23

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rnabioco/leech

Tutte le issue di rnabioco/leech

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.