* feat(cp): context parallelism for hybrid + VLM SFT
Unify model CP setup and make packed-boundary metadata CP-aware:
- setup_model_cp replaces setup_hybrid_cp/setup_nemotron_h_cp: models
owning linear-attention/Mamba layers expose
set_context_parallel_attributes (dense + MoE Qwen3.5, NemotronH) and
wire their own layers; hybrid models without the hook are rejected
instead of silently misconfigured.
- seq_lens stays global under CP: documents can straddle the shard
cut, so input_ids/position_ids shard per rank while seq_lens keeps
the full pre-shard boundaries, flagged via seq_lens_are_global
through forward() / prime_forward_kwargs into both Qwen3.5 models.
A cu_seqlens_are_global provenance flag rides along to fla's
GatedDeltaNet instead of reading cu_seqlens back (which cost one
CPU-GPU sync per linear-attention layer per microbatch); the CP
conv path switches to fla's causal_conv1d with a CP context so conv
state passes between ranks with document-boundary resets.
- VLM CP defers sharding to the model: the vision encoder and the
image-embed merge see the full sequence, then the root forward
shards embeds/positions (shard_position_ids_for_cp handles 3D
MRoPE) and updates ulysses attention params from global seq_lens.
The SFT trainer skips pre-sharding for MRoPE batches; the vision
encoder is pinned to SDPA under CP.
- shard_for_cp validates divisibility (uneven shards deadlock ulysses
all-to-all) and CatDataset's seq_len padding guarantees it; the
LoRA token count follows the sharded loss_mask.
- Qwen3.5 CP requires the custom implementation (the HF impl has no
set_context_parallel_attributes); rejected in get_model.