dmlc / gluon-nlp

NLP made easy
https://nlp.gluon.ai/
Apache License 2.0
2.56k stars 538 forks source link

gluonnlp on Cuda 10 cannot import name 'replace_file' #1201

Closed ktoetotam closed 4 years ago

ktoetotam commented 4 years ago

I am trying to run gluonnlp on cuda 10. I have installed the following package:

mxnet-cu100 1.6.0b20191102

https://pypi.org/project/mxnet-cu100mkl/#history

As it seems like the only one that has mxnet 1.6.0 and supports cuda 10. I have no possibility to upgrade to cuda 10.1 which has the official release for mxnet 1.6.0

The error I get looks like I am still on mxnet 1.5.0 but:

import mxnet as mx
print(mx.__version__)

1.6.0

It looks like the pre-release is not compatible? Do you know of any way to use gluonnlp on cuda 10.0? I cannot neither downgrade nor upgrade the cuda version.

The original error is:

ImportError                               Traceback (most recent call last)
<ipython-input-2-12f1dea70852> in <module>
     13 from mxnet import gluon, autograd
     14 from mxnet.gluon.utils import download
---> 15 import gluonnlp as nlp
     16 nlp.utils.check_version('0.7.0')

~/.local/lib/python3.6/site-packages/gluonnlp/__init__.py in <module>
     23 
     24 from . import loss
---> 25 from . import data
     26 from . import embedding
     27 from . import model

~/.local/lib/python3.6/site-packages/gluonnlp/data/__init__.py in <module>
     21 import os
     22 
---> 23 from . import (batchify, candidate_sampler, conll, corpora, dataloader,
     24                dataset, question_answering, registry, sampler, sentiment,
     25                stream, super_glue, transforms, translation, utils,

~/.local/lib/python3.6/site-packages/gluonnlp/data/question_answering.py in <module>
     29 
     30 from mxnet.gluon.data import ArrayDataset
---> 31 from mxnet.gluon.utils import download, check_sha1, _get_repo_file_url, replace_file
     32 from .registry import register
     33 from ..base import get_home_dir

ImportError: cannot import name 'replace_file'
eric-haibin-lin commented 4 years ago

can you try later versions of mxnet 1.6 from https://dist.mxnet.io/python e.g. mxnet_cu100-1.6.0-py2.py3-none-manylinux1_x86_64.whl ?

leezu commented 4 years ago

Closing the issue, as you are using an old nightly build of MXNet 1.6. Please upgrade to the released version or newer build(pip install --upgrade mxnet-cu100 or pip install --upgrade --pre mxnet-cu100<2 -f https://dist.mxnet.io/python/all)

ktoetotam commented 4 years ago

eric-haibin-lin thank you very very much! this solved my problem!

leezu, pip install --upgrade mxnet-cu100 this did not work as the mxnet-cu100 had 1.5.1

https://pypi.org/project/mxnet-cu100/

And we needed 1.6.1

Eric's solution worked!

shibuML commented 4 years ago

@ktoetotam I am not getting that 1.6.1 version file, can you help me in that.