raise RuntimeError(‘Attempting to deserialize object on a CUDA ‘ RuntimeError: Attempting to deseri

 raise RuntimeError('Attempting to deserialize object on a CUDA '
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.

rel_extractor.load_state_dict(torch.load(model_state_path))
改成
rel_extractor.load_state_dict(torch.load(model_state_path, map_location=‘cpu’))

你可能感兴趣的:(NLP实战项目,各种报错,pytorch,深度学习,神经网络)