我正在尝试实现 fastai pretrain 语言模型,它需要火炬才能工作。运行代码后,我遇到了一些关于导入火炬的问题。_C
我在我的 linux python 3.7.1 上运行它,通过 pip: torch 1.0.1.post2, cuda V7.5.17。我收到此错误:
Traceback (most recent call last):
File "pretrain_lm.py", line 7, in <module>
import fastai
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/__init__.py", line 1, in <module>
from .basic_train import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/basic_train.py", line 2, in <module>
from .torch_core import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/torch_core.py", line 2, in <module>
from .imports.torch import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/imports/__init__.py", line 2, in <module>
from .torch import *
File "/home/andira/anaconda3/lib/python3.7/site-packages/fastai/imports/torch.py", line 1, in <module>
import torch, torch.nn.functional as F
File "/home/andira/anaconda3/lib/python3.7/site-packages/torch/__init__.py", line 84, in <module>
from torch._C import *
ImportError: libtorch_python.so: cannot open shared object file: No such file or directory
所以我试图运行这一行:
from torch._C import *
并得到相同的结果
ImportError: libtorch_python.so: cannot open shared object file: No such file or directory
我查了一下/home/andira/anaconda3/lib/python3.7/site-packages/torch/lib,只有libcaffe2_gpu.so和libshm.so文件,我也找不到 libtorch_python.so 。我的问题是,libtorch_python.so 实际上是什么?我已经阅读了一些文章,并且像大多数文章一样讨论了未定义的符号,而不是无法打开共享对象文件:没有像我这样的文件或目录。我是 python 和 torch 的新手,所以我非常感谢你的回答。
函数式编程
相关分类