Files
ts-as-modality/configs/ts_encoder.yaml
T
张宗平 545802d62c feat(m2): TS Encoder — Patchify + 2-layer Transformer (T2.1)
- src/tsmm/model/ts_encoder.py: Patchify (channel-independent unfold) +
  TSEncoder (shared per-channel patch linear, mean-pool over channels,
  learnable positional embedding, 2-layer pre-norm Transformer, LayerNorm).
- configs/ts_encoder.yaml: encoder/projector hyperparameters.
- tests/test_ts_encoder.py: 10 tests (shape, n_patches formula, window
  values, determinism, gradient flow, param sanity).
- 61 tests passing; GPU fwd/bwd verified on RTX 3060 (39 MB peak).

Spec clarifications (small tier, comet-build Step 4):
- n_patches = (T-P)//S+1 ⇒ 127 for T=512 (design said 128; arithmetic slip).
- 'Channel-independent' = shared per-channel patch embed + mean-pool →
  C-free output [B,n_patches,d]; channel identity carried by [属性] tokens.
- Actual params ≈2.1M (design's '≈4M' was a rough estimate).
2026-06-30 00:16:54 +00:00

21 lines
635 B
YAML

# TS Encoder + Projector hyperparameters (T2.1 / T2.2)
# Design ref: docs/superpowers/specs/2026-06-29-ts-as-modality-design.md §2.2
# Patchify (channel-independent)
patch_len: 8 # P
stride: 4 # S (overlap); n_patches = (T - P) // S + 1
# TS Encoder (2-layer Transformer)
d: 256 # hidden dim
layers: 2
heads: 4
ffn_mult: 4 # dim_feedforward = d * ffn_mult
dropout: 0.1
# Projector (T2.2) — maps TS token d → LLM hidden
llm_hidden: 896 # Qwen2.5-0.5B hidden size
# Context
T: 512 # default window length → 127 TS tokens
max_patches: 2048 # positional-embedding budget