常见报错汇总

PyTorch

报错:

1
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.

解决:

1
torch.load(xxx)改成 torch.load(xxx,map_location='cpu')

TensorFlow

报错:

1
tensorflow2.0加载model出现AttributeError: ‘str‘ object has no attribute ‘decode‘

解决:

1
2
3
4
5
把h5py降到2.10.0版本就行了!!!!
安装keras自动给下载高版本h5py导致报错!!

pip install h5py==2.10.0
安装后重启服务

Nginx

报错:

1
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)

解决:

  1. 查看443端口是否被占用?是哪个占用的?
1
netstat -anon | grep 443
  1. 杀掉占用的443端口的进程
1
fuser -k 443/tcp
  1. 重启nginx
1
service nginx start
  1. 重新加载配置文件
1
nginx -s reload