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

forward() got an unexpected keyword argument 'is_causal' #21

Open
ShunyaOz opened this issue May 1, 2024 · 1 comment
Open

forward() got an unexpected keyword argument 'is_causal' #21

ShunyaOz opened this issue May 1, 2024 · 1 comment

Comments

@ShunyaOz
Copy link

ShunyaOz commented May 1, 2024

Hello, I'm a Japanese college student.
This is my first time to use MusicTransformer-Pytorch.
I refered to READ ME and Google Colab version, and I tried to train this model.

When I wrote
python3 train.py -output_dir rpr --rpr -batch_size=4 -epochs=150 -max_sequence=2048

,the terminal outputs
TypeError: forward() got an unexpected keyword argument 'is_causal'

Please tell me how to train this model.

@SkylarShadow
Copy link

Hello,I encountered the same issue when I ran the code.
There're 2 methods I found:
1.run this command:!pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchtext==0.14.1 torchaudio==0.13.1 torchdata==0.5.1 --extra-index-url https://download.pytorch.org/whl/cu117 (I haven't tried it yet)

  1. modify the function forward() in rpr.py and music_transformer.py. add " **kwargs " to the arguments of forward()
    def forward(self, src, mask=None, src_key_padding_mask=None):

    Modify it to: def forward(self, src, mask=None, src_key_padding_mask=None,**kwargs):
    def forward(self, tgt, memory, tgt_mask, memory_mask,tgt_key_padding_mask,memory_key_padding_mask):

    Modify it to: def forward(self, tgt, memory, tgt_mask, memory_mask,tgt_key_padding_mask,memory_key_padding_mask,,**kwargs):
    This method worked on my colab.
    BTW,please forgive my poor English😂

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

2 participants