Importing torchtext in Kaggle notebook
See original GitHub issue🐛 Bug
Describe the bug A clear and concise description of what the bug is.
There is a bug just by following PyTorch’s SST-2 tutorial online.
To Reproduce Steps to reproduce the behavior:
- Go to the demo online
- Just following the steps, code fails on
import torchtext.transforms as T
with torchtext==0.12.0 - Error:
----> 1 import torchtext.transforms as T
2 from torch.hub import load_state_dict_from_url
3
4 padding_idx = 1
5 bos_idx = 0
/opt/conda/lib/python3.7/site-packages/torchtext/transforms.py in <module>
4 import torch
5 from torchtext.data.functional import load_sp_model
----> 6 from torchtext.utils import get_asset_local_path
7 from torchtext.vocab import Vocab
8 from torchtext._torchtext import GPT2BPEEncoder as GPT2BPEEncoderPyBind, CLIPEncoder as CLIPEncoderPyBind
ImportError: cannot import name 'get_asset_local_path' from 'torchtext.utils' (/opt/conda/lib/python3.7/site-packages/torchtext/utils.py)
Expected behavior
The tutorial should work as it is.
Additional context
I’m on kaggle.com
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Usage with PyTorch and Torchtext library - Kaggle
Explore and run machine learning code with Kaggle Notebooks | Using data from ... import tokenizer and pretrained word embeddings from torchtext.data.utils ...
Read more >Pytorch | Torchtext - Kaggle
Explore and run machine learning code with Kaggle Notebooks | Using data from multiple data sources.
Read more >Using this dataset-Pytorch and torchtext - Kaggle
Explore and run machine learning code with Kaggle Notebooks | Using data from IMBD sentiment ... import os import torch from torchtext import...
Read more >Pytorch text classification : Torchtext + LSTM - Kaggle
In this notebook, We will be classifying text (The data-set used here contains ... import time import torch from torchtext import data import...
Read more >PyTorch, TorchText, Glove - Kaggle
Explore and run machine learning code with Kaggle Notebooks | Using data from multiple data sources.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So it looks like the default
torchtext
version in this tutorial is0.11.0
. I verified this using the following linesAfter installing torchtext
0.12.0
using!pip install torchtext==0.12.0
, we are able to get past the code failure. @parmeet do you know how we can update the defaulttorchtext
andtorch
versions for this tutorial?@mthrok
Nice to know the correct combination of libraries. Will be happy to report if anything else. Thanks a lot. Lastly, hopefully this will help other people too.