fairseq: cannot import name 'libnat_cuda' from 'fairseq' (fairseq-master/fairseq/__init__.py)... fall back to CPU version

❓ Questions and Help

Before asking:

  1. search the issues.
  2. search the docs.

What is your question?

Code

When I trying to train a new model for machine translation, always have the following errors. I try to change the version of fairseq but it is still not work.

cannot import name ‘libnat_cuda’ from ‘fairseq’ (/home/fairseq-master/fairseq/init.py)… fall back to CPU version cannot import name ‘libnat_cuda’ from ‘fairseq’ (/home/fairseq-master/fairseq/init.py)… fall back to CPU version cannot import name ‘libnat_cuda’ from ‘fairseq’ (/home/fairseq-master/fairseq/init.py)… fall back to CPU version

What have you tried?

What’s your environment?

  • fairseq Version (e.g., 0.9 or master):
  • PyTorch Version (e.g., 1.4)
  • OS (e.g., Linux):
  • How you installed fairseq (pip, source):source
  • Build command you used (if compiling from source):
  • Python version:3.7.7
  • CUDA/cuDNN version:10.0
  • GPU models and configuration:
  • Any other relevant information:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18

Most upvoted comments

Hi,

I hope to run lev_transformer on a cpu-only machine. I installed libnat, and there is a "linnet.cpython-36m-darwin.so’ in the fairseq source folder. But I met the problem of “cannot import name ‘libnat_cuda’… fall back to CPU version”, how can I solve it? Thanks!

export CUDA_HOME = xxx the xxx folder contains some version.txt. Then run setup.py again, you’ll see there’s a line saying libnat_cuda was built.

Thanks, I have solved it!

@Ir1d I solved it by python setup.py build_ext, no --inplace