Comments (3)
Hey @TParcollet, could you please have a look?
from speechbrain.
My local fix is something like this (using features_padding_mask):
padding_mask = make_padding_masks(wav, wav_len=wav_lens)
features_padding_mask = self.model._get_feature_vector_attention_mask(
sequence_length, padding_mask, add_adapter=False
)
# 1. Compute the indices that will be masked
mask_time_indices = _compute_mask_indices(
(batch_size, sequence_length),
mask_prob=self.mask_prob,
mask_length=self.mask_length,
attention_mask=features_padding_mask
)
torch_mask_time_indices = torch.tensor(
mask_time_indices, device=wav.device, dtype=torch.long,
)
# 2. Sample the negative samples from the entire sequence.
# Fairseq does it only on the masked indices, but this only work if you
# have long sentences. For more versatily, we sample on the entire sequence.
# value.
full_sentence_indices = np.ones((batch_size, sequence_length))
negative_sample_indices = torch.tensor(
transformers.models.wav2vec2.modeling_wav2vec2._sample_negative_indices(
(batch_size, sequence_length),
num_negatives=self.config.num_negatives,
# mask_time_indices=full_sentence_indices,
mask_time_indices=features_padding_mask.detach().cpu().numpy()
),
device=wav.device,
dtype=torch.long,
)
from speechbrain.
That's quite late to answer, but yes it certainly is true. The reason is that we rely on HF functions here, and back to when we wrote this code, I believe there was no alternative. @porfirythelaw could you propose a PR with this fix? I will test it.
Many thanks.
from speechbrain.
Related Issues (20)
- RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! HOT 2
- not able to import 'HuggingFaceWhisper' from speechbrain.lobes.models.huggingface_whisper HOT 7
- Adapters + LLama -- re-design. HOT 6
- Torch 2.3 breaks DDP? HOT 7
- Training twice as long with Torch > 1.11 HOT 10
- Training regression for Conformer-Transducer models HOT 2
- Math Domain Error in Pretraining tutorial. HOT 1
- Typing syntax not supported in 3.7/3.8 HOT 8
- Potential `SpectrogramDrop` bugs HOT 2
- dtype mismatch in AttentiveStatisticsPooling with FP16 training mode HOT 1
- Task ASR Reported: Caught ZeroDivisionError in DataLoader worker process 0. HOT 4
- Huggingface-Aishell get wrong prediction HOT 5
- AMD ROCm: Conformer-transducer diverges HOT 2
- AMD ROCm: `torch.backends.cudnn.benchmark` should be set to `False` by default on ROCm
- Wav2Vec2WordpieceTokenizer' object has no attribute '_create_trie' HOT 2
- Same result for different samples (with same name) using speech separation HOT 1
- Cannot reproduce the result in speech translation HOT 6
- [Bug] RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat1 in method wrapper_CUDA_addmm) HOT 1
- pip install --editable . didn't run in VS code HOT 3
- SoundChoice G2P seems to be broken HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from speechbrain.