Bug Record【持续更新】


问题1:RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0

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


问题2:OSError: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27’ not found

在这里插入图片描述

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

参考链接:


问题3:RuntimeError: result type Float can’t be cast to the desired output type Long

参考链接:


问题4:UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xb4 in position 178: illegal multibyte sequence

在这里插入图片描述
解决方案:

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')

参考链接:


问题5:ValueError: could not convert string to float: ‘30.226,42.7354,1.90

在这里插入图片描述

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’

参考链接:


问题6:Command “python setup.py egg_info” failed with error code 1 in C:\Users\xxx\pip-build-ecnk45nt\pywinpty\

在这里插入图片描述
解决方案:

更新插件

python -m pip install --upgrade setupTools
python -m pip install --upgrade pip

参考链接:


问题7:Failed building wheel for numba

Failed building wheel for numba
RuntimeError: Could not find a llvm-config binary. There are a number of reasons this could occur,
Failed building wheel for llvmlite
RuntimeError: Could not find a llvm-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

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

参考链接:


问题8:AttributeError: ‘numpy.float64’ object has no attribute ‘detach’

在这里插入图片描述
解决方法:

需要将变量转为 Tensor 类型。


问题9: Error in `python’: free(): invalid pointer: 0x000055ca0b8d2e08

*** 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 之前。

在这里插入图片描述


问题10:AssertionError: Checkpoint detectron2://ImageNetPretrained/MSRA/R-101.pkl not found!

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:这一行的路径改为自己下载的权重文件路径。

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

问题11:Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same

解决方案:
concat时,指定tensor的位置和类别与目标tensor一致。 i.e data.to(device=device, dtype=torch.float)

参考链接:

问题12:TypeError: ‘<’ not supported between instances of ‘State’ and ‘State’ heapq.heappush(pq, State(nextX, nextY, effortToNextNode))

解决方案:
Python中的heapq模块无法比较自定义类型的对象。在这种情况下,需要在自定义的State类中定义“小于”操作符(lt()方法),以便heapq可以正确地比较它们并进行堆排序。

class State:
    def __init__(self, x, y, effortToNextNode):
        self.x = x
        self.y = y
        self.effortToNextNode = effortToNextNode
    
    def __lt__(self, other):
        return self.effortToNextNode < other.effortToNextNode

其中,定义了一个“小于”操作符,使得堆队列按照effortToNextNode属性的值进行排序。在push时传递两个State对象,并且将按照他们的effortToNextNode属性进行排序。

问题13:AttributeError: module ‘distutils’ has no attribute ‘version’

setuptools版本问题。
解决方案

pip uninstall setuptools
pip install setuptools==59.5.0

问题14: AttributeError: module ‘numpy’ has no attribute ‘bool’?

downgrade numpy
解决方案

python -m pip uninstall numpy
python -m pip install numpy==1.23.1

问题15:ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device

服务器 /tmp 空间不足,非Root用户,在自己的根目录建一个tmp目录

解决方案:

$ cd ~
$ mkdir tmp
$ export TMPDIR=$HOME/tmp

参考链接:

问题16:Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

原因
tensor.to() 这个函数功能是产生一个新的tensor,并不会改变原数据。
方法:

inputs.to(device) -> inputs = inputs.to(device)

参考链接:
【已解决】Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值