pytorch3d报错:RuntimeError: Not compiled with GPU support.

目录

解决方法:编译之前:加上指令:

[解决方法:pytorch3d 安装命令(ubuntu),成功!!!](#解决方法:pytorch3d 安装命令(ubuntu),成功!!!)

测试代码:


FORCE_CUDA=1 works for me. Thanks!

python 复制代码
      args = (
            points,
            cloud_to_packed_first_idx,
            num_points_per_cloud,
            image_size,
            radius,
            points_per_pixel,
            bin_size,
            max_points_per_bin,
        )
        # pyre-fixme[16]: Module `pytorch3d` has no attribute `_C`.
        idx, zbuf, dists = _C.rasterize_points(*args)
        ctx.save_for_backward(points, idx)
        ctx.mark_non_differentiable(idx)
        return idx, zbuf, dists

解决方法:编译之前:加上指令:

set FORCE_CUDA=1

报错:没有指定CUDA_HOME

File "C:\Users\002\.conda\envs\glige\lib\site-packages\torch\utils\cpp_extension.py", line 1048, in CUDAExtension library_dirs += library_paths(cuda=True) File "C:\Users\002\.conda\envs\glige\lib\site-packages\torch\utils\cpp_extension.py", line 1186, in library_paths paths.append(_join_cuda_home(lib_dir)) File "C:\Users\002\.conda\envs\glige\lib\site-packages\torch\utils\cpp_extension.py", line 2223, in _join_cuda_home raise EnvironmentError('CUDA_HOME environment variable is not set. ' OSError: CUDA_HOME environment variable is not set. Please set it to your CUDA install root.

方法1 重新安装命令 没测:

pip install "git+https://github.com/facebookresearch/pytorch3d.git"

方法2:

解决方法:pytorch3d 安装命令(ubuntu),成功!!!

pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1110/download.html

File "C:\Users\002\.conda\envs\glige\lib\site-packages\torch\autograd\function.py", line 539, in apply

return super().apply(*args, **kwargs) # type: ignore[misc]

File "C:\Users\002\.conda\envs\glige\lib\site-packages\pytorch3d-0.7.7-py3.8-win-amd64.egg\pytorch3d\renderer\points\rasterize_points.py", line 214, in forward

idx, zbuf, dists = _C.rasterize_points(*args)

RuntimeError: Not compiled with GPU support

测试代码:

python 复制代码
import torch
from pytorch3d import _C
from pytorch3d.structures import Pointclouds

import torch

# 修改后的参数准备
points_tensor = torch.tensor([[0.5000, 0.5000, 0.5000], [1.0000, 1.0000, 1.0000]])
other_tensor = torch.tensor([[1., 2., 3.], [4., 5., 6.]])
value_tensor = torch.tensor(0.1000)

another_tensor = torch.tensor([0., 0., 0.])
int_value1 = 10
int_value2 = 0
int_value3 = 0

# 调用函数
idx, zbuf, dists = _C.rasterize_points(
    points_tensor,
    other_tensor,
    value_tensor,
    [10, 10],
    another_tensor,
    int_value1,
    int_value2,
    int_value3)

Traceback (most recent call last):

File "E:\project\inpaint\Inpaint-Anything-main\aaa2.py", line 18, in <module>

idx, zbuf, dists = _C.rasterize_points(

^^^^^^^^^^^^^^^^^^^^

RuntimeError: a Tensor with 3 elements cannot be converted to Scalar

相关推荐
HPC_fac1305206781614 分钟前
以科学计算为切入点:剖析英伟达服务器过热难题
服务器·人工智能·深度学习·机器学习·计算机视觉·数据挖掘·gpu算力
网易独家音乐人Mike Zhou3 小时前
【卡尔曼滤波】数据预测Prediction观测器的理论推导及应用 C语言、Python实现(Kalman Filter)
c语言·python·单片机·物联网·算法·嵌入式·iot
安静读书3 小时前
Python解析视频FPS(帧率)、分辨率信息
python·opencv·音视频
小陈phd3 小时前
OpenCV从入门到精通实战(九)——基于dlib的疲劳监测 ear计算
人工智能·opencv·计算机视觉
Guofu_Liao4 小时前
大语言模型---LoRA简介;LoRA的优势;LoRA训练步骤;总结
人工智能·语言模型·自然语言处理·矩阵·llama
小二·4 小时前
java基础面试题笔记(基础篇)
java·笔记·python
小喵要摸鱼6 小时前
Python 神经网络项目常用语法
python
一念之坤7 小时前
零基础学Python之数据结构 -- 01篇
数据结构·python
wxl7812278 小时前
如何使用本地大模型做数据分析
python·数据挖掘·数据分析·代码解释器
NoneCoder8 小时前
Python入门(12)--数据处理
开发语言·python