av-savchenko / face-emotion-recognition

Efficient face emotion recognition in photos and videos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on CPU with enet_b2_8_best model

ioctl-user opened this issue · comments

There is following error while running enet_b2_8_best model on CPU with the latest git hse package:

...
    fer = HSEmotionRecognizer(model_name = model_name)
  File "/home/build/.local/lib/python3.10/site-packages/hsemotion/facial_emotions.py", line 49, in __init__
    model=torch.load(path)
  File "/home/build/.local/lib/python3.10/site-packages/torch/serialization.py", line 712, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/home/build/.local/lib/python3.10/site-packages/torch/serialization.py", line 1049, in _load
    result = unpickler.load()
  File "/home/build/.local/lib/python3.10/site-packages/torch/serialization.py", line 1019, in persistent_load
    load_tensor(dtype, nbytes, key, _maybe_decode_ascii(location))
  File "/home/build/.local/lib/python3.10/site-packages/torch/serialization.py", line 1001, in load_tensor
    wrap_storage=restore_location(storage, location),
  File "/home/build/.local/lib/python3.10/site-packages/torch/serialization.py", line 175, in default_restore_location
    result = fn(storage, location)
  File "/home/build/.local/lib/python3.10/site-packages/torch/serialization.py", line 152, in _cuda_deserialize
    device = validate_cuda_device(location)
  File "/home/build/.local/lib/python3.10/site-packages/torch/serialization.py", line 136, 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.

At that, model enet_b0_8_best_afew works fine with the same script on the same CPU.

Thanks for letting me know. I fixed the issue and updated the latest code in the main branch. Please, kindly verify that it works now

Fix works, thank you!