When I extracted the sixth layer feature of hubert_checkpoint.pt as km, and then did the pre-training of Hubert, I found that features.size(1)=0.On line 420 of hubert.py, it reported an error: zerodivisionerror.I hope every boss can see why they report mistakes,thanks.
Code
Traceback (most recent call last):
File "fairseq_cli/hydra_train.py", line 27, in hydra_main
_hydra_main(cfg)
File "fairseq_cli/hydra_train.py", line 56, in _hydra_main
distributed_utils.call_main(cfg, pre_main, kwargs)
File "/home/gzf/fairseq/fairseq/distributed/utils.py", line 369, in call_main
main(cfg, kwargs)
File "/home/gzf/fairseq/fairseq_cli/train.py", line 190, in main
valid_losses, should_stop = train(cfg, trainer, task, epoch_itr)
File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, kwds)
File "/home/gzf/fairseq/fairseq_cli/train.py", line 316, in train
log_output = trainer.train_step(samples)
File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, *kwds)
File "/home/gzf/fairseq/fairseq/trainer.py", line 824, in train_step
loss, sample_size_i, logging_output = self.task.train_step(
File "/home/gzf/fairseq/fairseq/tasks/fairseq_task.py", line 517, in train_step
loss, sample_size, logging_output = criterion(model, sample)
File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(input, kwargs)
File "/home/gzf/fairseq/fairseq/criterions/hubert_criterion.py", line 61, in forward
net_output = model(target_list=sample["target_list"], *sample["net_input"])
File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(input, **kwargs)
File "/home/gzf/fairseq/fairseq/models/hubert/hubert.py", line 448, in forward
padding_mask = self.forward_padding_mask(features, padding_mask)
File "/home/gzf/fairseq/fairseq/models/hubert/hubert.py", line 420, in forward_padding_mask
extra = padding_mask.size(1) % features.size(1)
ZeroDivisionError: integer division or modulo by zero
What have you tried?
What's your environment?
fairseq Version (e.g., 1.0 or main):0.12.2
PyTorch Version (e.g., 1.0) 1.12.0
OS (e.g., Linux):linux
How you installed fairseq (pip, source): git
Build command you used (if compiling from source): python fairseq_cli/hydra_train.py --config-dir /home/gzf/fairseq/examples/hubert/config/pretrain --config-name hubert_base_librispeech \task.data=/home/gzf/wp/hf2/ task.label_dir=/home/gzf/wp/hf2/ task.labels='["km"]' model.label_rate=100
I had the same issue. It went away by setting padding=True in the config file. Not sure if that was the parameter used in the original paper, but it sure isn't the default in hubert_base_librispeech.yaml.
❓ Questions and Help
Before asking:
What is your question?
When I extracted the sixth layer feature of hubert_checkpoint.pt as km, and then did the pre-training of Hubert, I found that features.size(1)=0.On line 420 of hubert.py, it reported an error: zerodivisionerror.I hope every boss can see why they report mistakes,thanks.
Code
Traceback (most recent call last): File "fairseq_cli/hydra_train.py", line 27, in hydra_main _hydra_main(cfg) File "fairseq_cli/hydra_train.py", line 56, in _hydra_main distributed_utils.call_main(cfg, pre_main, kwargs) File "/home/gzf/fairseq/fairseq/distributed/utils.py", line 369, in call_main main(cfg, kwargs) File "/home/gzf/fairseq/fairseq_cli/train.py", line 190, in main valid_losses, should_stop = train(cfg, trainer, task, epoch_itr) File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/contextlib.py", line 75, in inner return func(*args, kwds) File "/home/gzf/fairseq/fairseq_cli/train.py", line 316, in train log_output = trainer.train_step(samples) File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/contextlib.py", line 75, in inner return func(*args, *kwds) File "/home/gzf/fairseq/fairseq/trainer.py", line 824, in train_step loss, sample_size_i, logging_output = self.task.train_step( File "/home/gzf/fairseq/fairseq/tasks/fairseq_task.py", line 517, in train_step loss, sample_size, logging_output = criterion(model, sample) File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "/home/gzf/fairseq/fairseq/criterions/hubert_criterion.py", line 61, in forward net_output = model(target_list=sample["target_list"], *sample["net_input"]) File "/home/gzf/anaconda3/envs/hubertT/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, **kwargs) File "/home/gzf/fairseq/fairseq/models/hubert/hubert.py", line 448, in forward padding_mask = self.forward_padding_mask(features, padding_mask) File "/home/gzf/fairseq/fairseq/models/hubert/hubert.py", line 420, in forward_padding_mask extra = padding_mask.size(1) % features.size(1) ZeroDivisionError: integer division or modulo by zero
What have you tried?
What's your environment?
pip
, source): git