You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to reproduce fine-tuning with Wav2vec2 on Librispeech, however using feature mask probability 0.0012 as in the paper makes the code crash at some point (after ~3_000 steps).
To reproduce
from transformers.models.wav2vec2.modeling_wav2vec2 import _compute_mask_indices
mask = _compute_mask_indices(
shape=(10, 500),
mask_prob=0.0012, # or even lower
mask_length=10,
)
print(mask)
raises
Traceback (most recent call last):
File "/home/nik/workspace/phd/repo/w2v2-mt-learning/playground/buggy_mask.py", line 3, in <module>
mask = _compute_mask_indices(
File "/home/nik/workspace/phd/repo/w2v2-mt-learning/.venv/lib/python3.8/site-packages/transformers/models/wav2vec2/modeling_wav2vec2.py", line 201, in _compute_mask_indices
dummy_mask_idx = spec_aug_mask_idx[0]
IndexError: index 0 is out of bounds for axis 0 with size 0
Note that using min_mask=1 prevents this issue as well.
Expected behavior
If the probability is so low that no features are masked, the method shouldn't raise an IndexError.
The text was updated successfully, but these errors were encountered:
nikvaessen
added a commit
to nikvaessen/transformers
that referenced
this issue
Nov 25, 2021
…face#14525)
* fixhuggingface#14524 (IndexError when mask prob is too low)
* fix formatting
* correct documentation, add option for setting min_num_masks
* change the semantic meaning of `mask_prob` in _compute_mask_indices
With this commit the meaing of `mask_prob` actually adhered to the probability for each
vector to be the start of a masked span of length.
* fix check_copies test
* fix documentation to semantic meaning of `upper bound of overall masking percentage`, revert changes to _compute_mask_indices
* fix typo
Environment info
transformers
version: 4.12.2Who can help
@patrickvonplaten
Information
I'm trying to reproduce fine-tuning with Wav2vec2 on Librispeech, however using feature mask probability 0.0012 as in the paper makes the code crash at some point (after ~3_000 steps).
To reproduce
raises
Note that using
min_mask=1
prevents this issue as well.Expected behavior
If the probability is so low that no features are masked, the method shouldn't raise an
IndexError
.The text was updated successfully, but these errors were encountered: