栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

RandLA-Net Pytorch版本: module not found error: no module named ‘torch

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

RandLA-Net Pytorch版本: module not found error: no module named ‘torch

torch_ points_ Kernels encountered modulenotfounderror: no module named ‘torch_ points_ kernels. points_ cpu’

在Debug RandLA-Net Pytorch版本代码时,按照Readme.md配置环境时,发现torch_ points_ Kernels encountered modulenotfounderror: no module named 'torch_ points_ kernels. points_ cpu’和torch_ points_ Kernels encountered modulenotfounderror: no module named 'torch_ points_ kernels. points_ cuda’两个问题

import torch
import torch.nn as nn

try:
    from torch_points import knn
    #from torch_points_kernels import knn
except (ModuleNotFoundError, ImportError):
    from torch_points_kernels import knn

错误提示:

ModuleNotFoundError: No module named 'torch_points_kernels.points_cpu'
ModuleNotFoundError: No module named 'torch_points_kernels.points_cuda'

环境配置:RTX 3090,CUDA 11.1,cudnn 8.0.5, Ubuntu 20.04, Pytorch 1.10.2,Python 3.6

重复安装多个版本的torch-points-kernels库,总是会报出以上两个错误中的一种,于是找到torch-points-kernels源码库解决问题

方法:

  1. 进入RandLA-Net-Pytorch文件夹克隆torch-points-kernels项目: git clone https://github.com/torch-points3d/torch-points-kernels
  2. 安装torch-points-kernels库,记得切换进torch-points-kernels项目(反正再安装一遍吧,都到这一步,死马当活马医,这都是torch-points-kernels项目中Readme.md的步骤)
pip install torch-points-kernels -i https://pypi.tuna.tsinghua.edu.cn/simple #采用临时镜像源会安装快一点
  1. 在torch-points-kernels项目中按照以下代码编译,
python setup.py build_ext --inplace
python -m unittest
  1. 这里我就把它放在RandLA-Net-Pytorch中没动了,因为之前我就clone进这个文件中了,试以下代码,如果没问题,基本就行了
import torch
import torch_points_kernels.points_cuda

我个人猜测应该是cuda和cudnn与pytorch版本不匹配导致的,因为在公司别人Windows电脑上又能pip下来,我为这个问题搞了好久,还重新装了CUDA和cudnn,最后没办法就把这个库下载下来编译了一遍,结果就好了,之前怎么试怎么不行,而且还能找到对应torch_points_kernels库,不知道怎么识别不到,害,都是啊,虽然能运行,但是,我又遇到问题,就是S3DIS数据集在这个代码运行,感觉没学到特征,唉,不管了,我又去用tensorflow版本了,tensorflow太难了,都不用

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1002262.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号