目录
[解决方法: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