RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.
但是我明明pytorch环境都是配好的呀,我在终端进行测试
这到底是为什么呢?我追踪到具体报错的那行代码, File “/root/anaconda3/lib/python3.11/site-packages/torch/serialization.py”, line 258, in validate_cuda_device,发现是conda环境里torch包里报的错
def validate_cuda_device(location):device = torch.cuda._utils._get_device_index(location, True)if not torch.cuda.is_available():raise RuntimeError('Attempting to deserialize object on a CUDA ''device but torch.cuda.is_available() is False. ''If you are running on a CPU-only machine, ''please use torch.load with map_location=torch.device(\'cpu\')''to map your storages to the CPU.')device_count = torch.cuda.device_count()if device >= device_count:raise RuntimeError('Attempting to deserialize object on CUDA device 'f'{device} but torch.cuda.device_count() is {device_count}. Please use ''torch.load with map_location to map your storages ''to an existing device.')return device
MySQL大事务可能会导致过多的占用临时文件,导致磁盘空间撑满的问题
本例说明下binlog cache产生的临时文件 案例复现
调小binlog_cache_size,让DML使用临时文件 使用存储过程模拟大事务
创建表 create table t1( id int AUTO_INCREMENT, name varchar…