google/uis-rnn

[Bug] Making a prediction on CPU after training on GPU

pthavarasa opened this issue · 0 comments

Describe the bug

Making a prediction on CPU after training on GPU, getting running time error.

To Reproduce

Train UIS-RNN on GPU
Predict on CPU only machine

Commands and arguments

Default arguments.

Logs

Traceback (most recent call last):
  File ".\speakerDiarization.py", line 207, in <module>
    main(r'wavs/rmdmy.wav', embedding_per_second=1.2, overlap_rate=0.4)
  File ".\speakerDiarization.py", line 158, in main
    uisrnnModel.load(SAVED_MODEL_NAME)
  File "C:\Users\Prasanth\Desktop\VScode\stage\Speaker-Diarization\uisrnn\uisrnn.py", line 151, in load
    var_dict = torch.load(filepath)
  File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\serialization.py", line 607, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\serialization.py", line 882, in _load
    result = unpickler.load()
  File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\serialization.py", line 857, in persistent_load
    load_tensor(data_type, size, key, _maybe_decode_ascii(location))
  File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\serialization.py", line 846, in load_tensor
    loaded_storages[key] = restore_location(storage, location)
  File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\serialization.py", line 175, in default_restore_location
    result = fn(storage, location)
  File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\serialization.py", line 151, in _cuda_deserialize
    device = validate_cuda_device(location)
  File "C:\Users\Prasanth\AppData\Local\Programs\Python\Python37\lib\site-packages\torch\serialization.py", line 135, in validate_cuda_device
    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.

Versions

  • uis-rnn git HEAD: 0.1.0
  • numpy: 1.18.5
  • scipy: 1.7.3
  • torch: 1.10.2