Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

TypeError: cross_entropy() got an unexpected keyword argument 'reduction' #15

Closed
Julisa-test opened this issue Feb 23, 2019 · 2 comments

Comments

@Julisa-test
Copy link

Hi, @glample

I trained with a single GPU and got an err just like the them shown.
Running command:
First: ./get-data-nmt.sh --src en --tgt fr
got:
===== Data summary
Monolingual training data:
en: ./data/processed/en-fr/train.en.pth
fr: ./data/processed/en-fr/train.fr.pth
Monolingual validation data:
en: ./data/processed/en-fr/valid.en.pth
fr: ./data/processed/en-fr/valid.fr.pth
Monolingual test data:
en: ./data/processed/en-fr/test.en.pth
fr: ./data/processed/en-fr/test.fr.pth
Parallel validation data:
en: ./data/processed/en-fr/valid.en-fr.en.pth
fr: ./data/processed/en-fr/valid.en-fr.fr.pth
Parallel test data:
en: ./data/processed/en-fr/test.en-fr.en.pth
fr: ./data/processed/en-fr/test.en-fr.fr.pth
And then run: python train.py --exp_name 'my_enfr_mlm' --dump_path './dumped/' --exp_id 'bs.20' --data_path './data/processed/en-fr/' --lgs 'en-fr' --clm_steps '' --mlm_steps 'en,fr' --emb_dim '1024' --n_layers '6' --n_heads '8' --dropout '0.1' --attention_dropout '0.1' --gelu_activation 'true' --batch_size '8' --bptt '256' --optimizer 'adam,lr=0.0001' --epoch_size '300000' --validation_metrics '_valid_mlm_ppl' --stopping_criterion '_valid_mlm_ppl,10'

got the err.

@glample
Copy link
Contributor

glample commented Feb 23, 2019

Hi,

Can you copy paste the full error traceback that includes the line where the error occurs?

In any case, it looks like the error happens when a F.cross_entropy is called. Which version of PyTorch are you using? The code is compatible with PyTorch 1.0.1 and PyTorch 0.4.3 so you may be using a quite old. Could you try to update PyTorch and rerun the code?

@Julisa-test
Copy link
Author

The version of PyTorch I used is 0.4.1, which is exactly caused by the version being too low. Thank you for your reply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants