I run Transformer model in DGL and came across some error

I have modified the file ‘translation_train.py’ as below according to my environment:


And I got error as below:

This error may be caused by this function in models.py line 82:

I have no idea to fix it.

Hi, have you installed dgl with cuda support?

For example, if your cuda version is 10.0, you can install dgl with

conda install -c dglteam dgl-cuda10.0 

or

pip install dgl-cu100