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.

Volc·2022년 4월 5일
0

Error

목록 보기
20/62

Error

  • GPU로 학습하여 저장한 모델 전체를 cpu로 불러오니 에러가 발생하였다.

Error 해결

  • 코드를 다음과 같이 변경하여 불러오니 해결되었다.
    //변경 전
    model1 = torch.load('./7emotions_model.pt')
    
    //변경 후
    model1 = torch.load('./7emotions_model.pt',map_location='cpu')

참고 사이트

모델 저장하기 & 불러오기 - PyTorch Tutorials 1.10.2+cu102 documentation

profile
미래를 생각하는 개발자

0개의 댓글