RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0
device = torch.device("cuda")
a = a.to(device) #指定设备
参考链接:
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu on transormer
Traceback (most recent call last):
File “test.py”, line 2, in
import open3d as o3d
File “/data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/site-packages/open3d/init.py”, line 56, in
_CDLL(str(next((_Path(file).parent / ‘cpu’).glob(‘pybind*’))))
File “/data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/ctypes/init.py”, line 348, in init
self._handle = _dlopen(self._name, mode)
OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27’ not found (required by /data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/site-packages/open3d/cpu/pybind.cpython-36m-x86_64-linux-gnu.so)
解决方案:
将open3d的安装版本改为 0.8,执行如下指令:
pip uninstall open3d
pip install open3d==0.8
参考链接:
参考链接:
if you will open file with utf-8,then you need write:
open(file_name, 'r', encoding='UTF-8')
if you will open file with GBK,then you need do:
open(file_name, 'rb')
参考链接:
Traceback (most recent call last):
File “exactFeature.py”, line 82, in
parts = loadSearch(’./data_search’)
File “exactFeature.py”, line 16, in loadSearch
part = np.loadtxt(path, delimiter=’ ')
File “/data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/site-packages/numpy/lib/npyio.py”, line 1139, in loadtxt
for x in read_data(_loadtxt_chunksize):
File “/data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/site-packages/numpy/lib/npyio.py”, line 1067, in read_data
items = [conv(val) for (conv, val) in zip(converters, vals)]
File “/data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/site-packages/numpy/lib/npyio.py”, line 1067, in
items = [conv(val) for (conv, val) in zip(converters, vals)]
File “/data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/site-packages/numpy/lib/npyio.py”, line 763, in floatconv
return float(x)
ValueError: could not convert string to float: ‘30.226,42.7354,1.905’
参考链接:
更新插件
python -m pip install --upgrade setupTools
python -m pip install --upgrade pip
参考链接:
Failed building wheel for numba
RuntimeError: Could not find allvm-config
binary. There are a number of reasons this could occur,
Failed building wheel for llvmlite
RuntimeError: Could not find allvm-config
binary. There are a number of reasons this could occur
Command “/data3/zhanghuiyong/anaconda3/envs/torch/bin/python -u -c “import setuptools, tokenize;file=’/tmp/pip-build-s9czqwfi/llvmlite/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-7rz1woww-record/install-record.txt --single-version-externally-managed --compile” failed with error code 1 in /tmp/pip-build-s9czqwfi/llvmlite/
解决方案:
升级 pip 版本
pip install --upgrade pip
参考链接:
需要将变量转为 Tensor 类型。
*** Error in `python’: free(): invalid pointer: 0x000055ca0b8d2e08 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7f44e4dd37f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7f44e4ddc38a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f44e4de058c]
…
…
/PointAugment/lib/python3.6/lib-dynload/_lzma.cpython-36m-x86_64-linux-gnu.so
7f35c511b000-7f35c511e000 r-xp 00003000 08:11 58079482 /data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/lib-dynload/_lzma.cpython-36m-x86_64-linux-gnu.so
7f35c511e000-7f35c511f000 r–p 00006000 08:11 58079482 /data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/lib-dynload/_lzma.cpython-36m-x86_64-linux-gnu.so
7f35c511f000-7f35c5120000 —p 00007000 08:11 58079482 /data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/lib-dynload/_lzma.cpython-36m-x86_64-linux-gnu.so
7f35c5120000-7f35c5121000 r–p 00007000 08:11 58079482 /data/xinjianjia/anaconda3/envs/PointAugment/lib/python3.6/lib-dynload/_lzma.cpython-36m-x86_64-linux-gnu.soAborted (core dumped)
需要将import open3d as o3d
的顺序放在 import torch
之前。
Traceback (most recent call last):
File “tools/train_net.py”, line 225, in
args=(args,),
File “/data3/zhanghuiyong/detectron2-0.2.1/detectron2/engine/launch.py”, line 62, in launch
main_func(*args)
File “tools/train_net.py”, line 208, in main
trainer.resume_or_load(resume=args.resume)
File “/data3/zhanghuiyong/detectron2-0.2.1/detectron2/engine/defaults.py”, line 311, in resume__load
checkpoint = self.checkpointer.resume_or_load(self.cfg.MODEL.WEIGHTS, resume=resume)
File “/data3/zhanghuiyong/anaconda3/envs/SOTR/lib/python3.6/site-packages/fvcore/common/checkpot.py”, line 227, in resume_or_load
return self.load(path, checkpointables=[])
File “/data3/zhanghuiyong/anaconda3/envs/SOTR/lib/python3.6/site-packages/fvcore/common/checkpot.py”, line 153, in load
assert os.path.isfile(path), “Checkpoint {} not found!”.format(path)
AssertionError: Checkpoint detectron2://ImageNetPretrained/MSRA/R-101.pkl not found!
解决方案:
修改配置文件,将WEIGHTS:这一行的路径改为自己下载的权重文件路径。