pytorch-seq2seq
pytorch-seq2seq copied to clipboard
Tutorial 3: failed to run in google colab
I tried to run tutorial 3 in google colab
It succeeded many days ago, but not today. I encountered an odd bug in the following code: from torchtext.datasets import TranslationDataset, Multi30k
ImportError: cannot import name 'TranslationDataset' from 'torchtext.datasets' (/usr/local/lib/python3.7/dist-packages/torchtext/datasets/init.py)
These codes ran well: import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F
What's wrong?
funny, this problem has been solved by: !pip uninstall torchtext !pip install torchtext
and now the version is: torch==1.8.0 torchtext-0.9.0
failed again with nothing changed, except for a reconnection
still not figure out what's happing , sad
## always follow this sequence: ## first connect and set GPU
## run these: # !pip uninstall torchtext # !pip install -U torchtext==0.8.0 ## agree to restart, ## run your pytorch program first,until you see bug report: xxx undefined
## then run these: # !pip uninstall torchtext # !pip install torchtext ## agree to restart
## then run these # !python -m spacy download en # !python -m spacy download de ## then you can run the code normally ## reason unknown
These bugs are because of some big API changes in torchtext between versions 0.8 and 0.9.
I need to update the tutorials appropriately, but haven't yet had the chance to do so. I will work on it this weekend.
These bugs are because of some big API changes in torchtext between versions 0.8 and 0.9.
I need to update the tutorials appropriately, but haven't yet had the chance to do so. I will work on it this weekend.
Thank you
This should now be fixed.
If you're using PyTorch 1.8 and torchtext 0.9 then the master
branch should work.
If you're using PyTorch 1.7 and torchtext 0.8 then the torchtext08
branch should work.
Please let me know if you encounter any more issues and I'll try and fix them ASAP.