Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【museformer】TypeError: forward() got multiple values for argument 'key_padding_mask' #85

Closed
hhhyc333 opened this issue Nov 19, 2022 · 8 comments

Comments

@hhhyc333
Copy link

hi,I run bash ttrain/mf-lmd6remi-1.sh and
bash tval/val__mf-lmd6remi-x.sh 1 checkpoint_best.pt 10240 in museformer
it will be:
2022-11-19 13:04:11 | WARNING | fairseq.tasks.fairseq_task | 844 samples have invalid sizes and will be skipped, max_positions=1024, first few sample ids=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2022-11-19 13:04:11 | INFO | fairseq.trainer | begin training epoch 1
Traceback (most recent call last):
File "/home/hyc/anaconda3/envs/musefo/bin/fairseq-train", line 8, in
sys.exit(cli_main())
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq_cli/train.py", line 352, in cli_main
distributed_utils.call_main(args, main)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq/distributed_utils.py", line 283, in call_main
torch.multiprocessing.spawn(
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 230, in spawn
return start_processes(fn, args, nprocs, join, daemon, start_method='spawn')
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 188, in start_processes
while not context.join():
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 150, in join
raise ProcessRaisedException(msg, error_index, failed_process.pid)
torch.multiprocessing.spawn.ProcessRaisedException:

-- Process 2 terminated with the following error:
Traceback (most recent call last):
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/multiprocessing/spawn.py", line 59, in _wrap
fn(i, *args)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq/distributed_utils.py", line 270, in distributed_main
main(args, **kwargs)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq_cli/train.py", line 125, in main
valid_losses, should_stop = train(args, trainer, task, epoch_itr)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq_cli/train.py", line 208, in train
log_output = trainer.train_step(samples)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq/trainer.py", line 480, in train_step
loss, sample_size_i, logging_output = self.task.train_step(
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq/tasks/fairseq_task.py", line 416, in train_step
loss, sample_size, logging_output = criterion(model, sample)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq/criterions/cross_entropy.py", line 35, in forward
net_output = model(**sample["net_input"])
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/nn/parallel/distributed.py", line 705, in forward
output = self.module(*inputs[0], **kwargs[0])
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/fairseq/models/fairseq_model.py", line 481, in forward
return self.decoder(src_tokens, **kwargs)
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyc/tmp/museformer/museformer/museformer_decoder.py", line 413, in forward
x, extra = self.extract_features(
File "/home/hyc/tmp/museformer/museformer/museformer_decoder.py", line 645, in extract_features
(sum_x, reg_x), inner_states = self.run_layers(
File "/home/hyc/tmp/museformer/museformer/museformer_decoder.py", line 731, in run_layers
x, _ = layer(
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/hyc/tmp/museformer/museformer/museformer_decoder_layer.py", line 413, in forward
x, attn = self.run_self_attn(
File "/home/hyc/tmp/museformer/museformer/museformer_decoder_layer.py", line 486, in run_self_attn
r, weight = self.self_attn(
File "/home/hyc/anaconda3/envs/musefo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
result = self.forward(*input, **kwargs)
TypeError: forward() got multiple values for argument 'key_padding_mask'

fairseq is 0.10.2 torch is 1.8.0
python is 3.8
who know why?

@hhhyc333 hhhyc333 changed the title TypeError: forward() got multiple values for argument 'key_padding_mask' 【museformer】TypeError: forward() got multiple values for argument 'key_padding_mask' Dec 29, 2022
@btyu
Copy link
Collaborator

btyu commented Dec 29, 2022

Hi! We have fixed this problem in the last commit. Thank you.

@SkyAndCloud
Copy link

I failed at the 1st step of README. How to obtain the normalized midi files? @hhhyc333

@hhhyc333
Copy link
Author

hhhyc333 commented Jan 3, 2023

Put your midi dataset into data/midi and run the command in 1. Dataset to normalized them.

@hhhyc333
Copy link
Author

hhhyc333 commented Jan 3, 2023

@SkyAndCloud

@SkyAndCloud
Copy link

@hhhyc333 Hello, thanks for your advice. I have tried it and met the same error as #81 . How did you fix this problem?

@DiegoBear
Copy link

@SkyAndCloud If you are getting the same error as #81, it means you haven't put your midis in the 6-instrument format requested by Museformer. Make sure the instrument ids of your midis are the same as the .readme. You can change the program/instrument ids of a midi automatically using miditoolkit.

@btyu
Copy link
Collaborator

btyu commented Jan 10, 2023

Hi @SkyAndCloud! For the instrument issue, please kindly refer to #81 (comment). Thanks.

@btyu
Copy link
Collaborator

btyu commented Mar 29, 2023

Since there is no update, I am closing this issue. Feel free to reopen it if needed.

@btyu btyu closed this as completed Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants