pytorch / text

Models, data loaders and abstractions for language processing, powered by PyTorch
https://pytorch.org/text
BSD 3-Clause "New" or "Revised" License
3.5k stars 812 forks source link

Segmentation fault with vocab.py #1082

Open aimanmutasem opened 3 years ago

aimanmutasem commented 3 years ago

Helo dears,

I'm trying to load pre-training mode as bellow code:

url = 'https://dl.fbaipublicfiles.com/fasttext/vectors-wiki/wiki.ar.vec'
SRC.build_vocab(train_data, vectors=Vectors('wiki.ar.vec', url=url), unk_init = torch.Tensor.normal_, min_freq = 2) 
TRG.build_vocab(train_data, min_freq = 2)

I get an unusual error like :

Fatal Python error: Segmentation fault

Current thread 0x00007f054de01740 (most recent call first):
File "/home/aiman/anaconda3/lib/python3.7/site-packages/torchtext/vocab.py", line 387 in cache
File "/home/aiman/anaconda3/lib/python3.7/site-packages/torchtext/vocab.py", line 323 in __init__
File "test.py", line 101 in <module>

I have update torchtext and conda but still not fix.

The environment as bellow:

pytorch-ignite==0.4.2
pytorch-nlp==0.5.0
torch==1.4.0
torchaudio==0.4.0a0+719bcc7
torchtext==0.6.0
torchvision==0.5.0

Any suggestions to fix this issue?

zhangguanheng66 commented 3 years ago

Could you try to update torchtext to 0.8.0 and torch to 1.7.0?

aimanmutasem commented 3 years ago

Thank you for your valuable feedback.

My conda version is 10.0, I have downgrade to 1.3.0, the new problem that I had is I can't call torch.

ImportError: No module named torch

[aiman@ibm-game-center ~]$ pip freeze | grep torch
torch==1.3.1+cu100
torch-cluster==1.3.0
torch-geometric==1.2.0
torch-scatter==1.2.0
torch-sparse==0.4.0
torchtext==0.8.0
torchvision==0.4.2+cu100
[aiman@ibm-game-center ~]$ python
Python 2.7.5 (default, Apr  2 2020, 13:16:51)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import torch Traceback (most recent call last): File "", line 1, in ImportError: No module named torch `

Any suggestions?

zhangguanheng66 commented 3 years ago

You may want to have a "fresh" install. torch==1.3.1+cu100 is not compatible with torchtext==0.8.0 and torchvision==0.4.2+cu100.

aimanmutasem commented 3 years ago

Dear Mr. @zhangguanheng66 Thank you for your valuable comment.

I have Cuda version 10.0 and I can't upgrade to upper versions (I don't have administrator access).

Torch versions (1.2.0, 1.3.0, 1.3.1, and 1.4.0) gives me a segmentation fault error when load data. The possible solution is to update Pytorch to 1.5.0 but I can't because of my Cuda version 10.0.

When I tried to install Pytorch using pip I got a No model named torch error.

My questions are:

  1. Is there any way to fix the segmentation fault issue with versions below 1.4.0?
  2. Why I get a No model named torch error when I use pip to install Pytorch?

Kind regards, Aiman