stat453-deep-learning-ss20
stat453-deep-learning-ss20 copied to clipboard
torchtext legacy
Hello, how do I run this in google colab? The problem is that data and datasets have now moved in .legacy. thanks for any help
same problem in
1_lstm.ipynb
### Defining the feature processing
TEXT = torchtext.legacy.data.Field(
tokenize='spacy', # default splits on whitespace
tokenizer_language='en_core_web_sm'
)
### Defining the label processing
LABEL = torchtext.legacy.data.LabelField(dtype=torch.long
AttributeError Traceback (most recent call last)
in 1 ### Defining the feature processing 2 ----> 3 TEXT = torchtext.legacy.data.Field( 4 tokenize='spacy', # default splits on whitespace 5 tokenizer_language='en_core_web_sm' AttributeError: module 'torchtext' has no attribute 'legacy'
You can try to downgrade torchtext to an older version. E.g., torchtext 0.9 should support torchtext.legacy. To downgrade it, you can run
!pip install torchtext==0.9
in a Google Colab cell