Repository navigation
FIX MEDFormer crashed for windows longer than 5000 samples - #1311
Merged
bruAristimunha merged 3 commits intoOct 10, 2026
Merged
Conversation
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MEDFormeradds a sinusoidal table indexed by time sample (_ListPatchEmbedding.channel_embedding), built with a fixedmax_len=5000. Windows longer than 5000 samples (30 s at 200 Hz, 10 s at 1000 Hz, ...) crashed inforwardwithThe size of tensor a (6000) must match the size of tensor b (5000). The table now hasmax(5000, n_times)rows; its first 5000 rows are the same values, so the buffer and outputs of windows up to 5000 samples are unchanged.Geometry grid (251 cells): cells crashing in
forward, master 53 (every window above 5000 samples), this PR 0 (251/251 cells run).Parity vs master (fp32, CPU; sha1 of tensors, equal = max-abs 0.0) on the 198 cells that ran on master (initial state dict, eval output, train loss, gradients, state dict after a train step): 198/198 identical. TorchScript scripted == eager unchanged. No released checkpoint.
Tests: new
test_medformer_window_longer_than_5000_samplesfails on master and passes here. Suites-k MEDFormer: 36 passed on master, 37 here.