-
Couldn't load subscription status.
- Fork 813
Can't seem to get torchtext.experimental functions. #1079
Description
❓ Questions and Help
Description
I am on Ubuntu using pip in a venv.
Current Version:
Python: 3.6.9
CUDA: 10.2
torch==1.7.0
torchsummary==1.5.1
torchtext==0.8.0
torchvision==0.8.1
I tried updating my previous version of torchtext from 0.5.0 to 0.8.0 as I wanted to use the pretrained SP (sentencepiece) functions added to the torchtext.experimental.functional library.
Before the update I was able to load the experimental.dataset feature.
from torchtext.experimental.datasets import IMDB successfully on torch=1.5 and torchtext=0.5
However, transform had an issue: ModuleNotFoundError: No module named 'torchtext.experimental.transforms'.
So, I upgraded torchtext to 0.8. and got the following traceback:
>>> from torchtext.experimental.transforms import pretrained_sp_model
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/<USER>/Code/pytorch_lightning/DLGPU/lib/python3.6/site-packages/torchtext/__init__.py", line 40, in <module>
_init_extension()
File "/home/<USER>/Code/pytorch_lightning/DLGPU/lib/python3.6/site-packages/torchtext/__init__.py", line 36, in _init_extension
torch.ops.load_library(ext_specs.origin)
File "/home/<USER>/Code/pytorch_lightning/DLGPU/lib/python3.6/site-packages/torch/_ops.py", line 105, in load_library
ctypes.CDLL(path)
File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/<DLGPU>/Code/pytorch_lightning/DLGPU/lib/python3.6/site-packages/torchtext/_torchtext.so: undefined symbol: _ZN3c1023_fastEqualsForContainerERKNS_6IValueES2_
So, I thought there was an issue with my old torch version with the new torchtext and hence I upgraded torch from 1.5.1 to 1.7:
pip install --upgrade torch
Collecting torch
Downloading torch-1.7.0-cp36-cp36m-manylinux1_x86_64.whl (776.7 MB)
Installing collected packages: typing-extensions, torch
Attempting uninstall: torch
Found existing installation: torch 1.5.1
Uninstalling torch-1.5.1:
Successfully uninstalled torch-1.5.1
After this step, I obtained some inconsistency with allennlp library.
torchvision 0.4.2 requires torch==1.3.1, but you'll have torch 1.7.0 which is incompatible.
allennlp 1.0.0 requires torch<1.6.0,>=1.5.0, but you'll have torch 1.7.0 which is incompatible.
So, finally removed all torch and torch dependednt libraries and reinstalled them. Current version:
pytorch-lightning==1.0.5
pytorch-nlp==0.5.0
texar-pytorch==0.1.1
torch==1.7.0
torchsummary==1.5.1
torchtext==0.8.0
torchvision==0.8.1
allennlp==1.2.1
And, finally the issue that is persisting:
>>> from torchtext.experimental.functional import sequential_transforms, vocab_func, totensor
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'torchtext.experimental'
Am I doing something wrong? Or, on the wrong version of any library?
PS: Mentioning @zhangguanheng66 JIC I can get some specific idea about the Sentencepiece function?