transformers
0b80c4ab - Fix interval merge invariant in _find_disjoint (#47860)

Commit
14 days ago
Fix interval merge invariant in _find_disjoint (#47860) Fix interval merge invariant in `_find_disjoint` `_find_disjoint` implements a sweep-line merge over tensor memory ranges, but assigns `last_stop = stop` instead of tracking the running maximum. When a tensor is strictly contained inside an earlier, larger one, `last_stop` shrinks to the contained tensor's end pointer, so a subsequent tensor that genuinely overlaps the larger one is classified as disjoint. Use `last_stop = max(last_stop, stop)`, the standard sweep-line invariant. Note on impact: this is a latent correctness fix, not a user-facing bug fix. Triggering the mis-classification requires strict containment, which in turn guarantees the resulting group is not "identical" in `_find_identical`, so `remove_tied_weights_from_state_dict` raises the same RuntimeError either way. Verified exhaustively over all 3- and 4-interval configurations (54k cases): the corrected version matches ground-truth connected components in 100% of cases, and the raise-vs-succeed outcome never differs. The observable improvement is that the error message now reports the complete set of overlapping tensors instead of a truncated one.
Author
Parents
Loading