transformers
07bba3bb - Make whole word masking linear in sequence length (#51394)

Commit
2 hours ago
Make whole word masking linear in sequence length (#51394) * Make whole word masking linear in sequence length Replace the pairwise same_word table in _whole_word_mask with a word-id lookup (np.unique + np.isin). Output is unchanged; memory drops from O(L^2) to O(L) per row. Adds a test comparing against the old pairwise logic on random inputs. * Drop the redundant np.unique before np.isin --------- Co-authored-by: Matt <rocketknight1@gmail.com>
Author
Parents
Loading