Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to deserialize object on CUDA device #7

Open
SuperMaximus1984 opened this issue Sep 23, 2023 · 1 comment
Open

Attempting to deserialize object on CUDA device #7

SuperMaximus1984 opened this issue Sep 23, 2023 · 1 comment

Comments

@SuperMaximus1984
Copy link

Please clarify what's the reason and how to troubleshoot?

(xtalker) max@Firestarter:/mnt/d/Python Stuff/xtalker$ python3.8 inference.py --driven_audio audio.wav --source_image image.jpg --result_dir ./results --cpu --bf16
using safetensor as default
start to generate video... 1695504166.066598
device========= cpu
---------device----------- cpu
Traceback (most recent call last):
  File "inference.py", line 219, in <module>
    main(args)
  File "inference.py", line 43, in main
    preprocess_model = CropAndExtract(sadtalker_paths, device)
  File "/mnt/d/Python Stuff/xtalker/src/utils/preprocess.py", line 49, in __init__
    self.propress = Preprocesser(device)
  File "/mnt/d/Python Stuff/xtalker/src/utils/croper.py", line 22, in __init__
    self.predictor = KeypointExtractor(device)
  File "/mnt/d/Python Stuff/xtalker/src/face3d/extract_kp_videos_safe.py", line 28, in __init__
    self.detector = init_alignment_model('awing_fan',device=device, model_rootpath=root_path)
  File "/home/max/anaconda3/envs/xtalker/lib/python3.8/site-packages/facexlib/alignment/__init__.py", line 19, in init_alignment_model
    model.load_state_dict(torch.load(model_path)['state_dict'], strict=True)
  File "/home/max/anaconda3/envs/xtalker/lib/python3.8/site-packages/torch/serialization.py", line 815, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/max/anaconda3/envs/xtalker/lib/python3.8/site-packages/torch/serialization.py", line 1043, in _legacy_load
    result = unpickler.load()
  File "/home/max/anaconda3/envs/xtalker/lib/python3.8/site-packages/torch/serialization.py", line 980, in persistent_load
    wrap_storage=restore_location(obj, location),
  File "/home/max/anaconda3/envs/xtalker/lib/python3.8/site-packages/torch/serialization.py", line 217, in default_restore_location
    result = fn(storage, location)
  File "/home/max/anaconda3/envs/xtalker/lib/python3.8/site-packages/torch/serialization.py", line 182, in _cuda_deserialize
    device = validate_cuda_device(location)
  File "/home/max/anaconda3/envs/xtalker/lib/python3.8/site-packages/torch/serialization.py", line 166, 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
@Spycsh
Copy link
Owner

Spycsh commented Sep 25, 2023

@SuperMaximus1984 , please check #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants