Skip to content

Optimize DiT text embedding with batched per-sample seq handling - #1267

Merged
SWivid merged 3 commits into
SWivid:mainfrom
QingyuLiu0521:qyl/pr-dit-only
Feb 16, 2026
Merged

SWivid merged 3 commits into
SWivid:mainfrom
QingyuLiu0521:qyl/pr-dit-only

Conversation

@QingyuLiu0521

@QingyuLiu0521 QingyuLiu0521 commented Feb 16, 2026 •

Copy link
Copy Markdown
Contributor

This PR updates src/f5_tts/model/backbones/dit.py to preserve correct variable-length text conditioning while removing per-sample Python loops in text embedding.

  • It switches to batched text_embed(text, seq_lens, ...), supports per-sample seq_len masking, and zeroes tail embeddings after lookup (p >= seq_len[i]).
  • It applies positional encoding only on valid positions per sample and fixes average upsampling to use per-sample target lengths.
  • Result: same intended behavior for mixed-length batches, with lower overhead and better training throughput.

@SWivid SWivid mentioned this pull request Feb 16, 2026
4 of 7 tasks
@SWivid
SWivid merged commit 6525015 into SWivid:main Feb 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants