OpenTalker / SadTalker

[CVPR 2023] SadTalker:Learning Realistic 3D Motion Coefficients for Stylized Audio-Driven Single Image Talking Face Animation
https://sadtalker.github.io/
Other
11.7k stars 2.18k forks source link

RuntimeError: CUDA error: out of memory kp_canonical = kp_detector(source_image) error #722

Open SuperGoodGame opened 10 months ago

SuperGoodGame commented 10 months ago

i try to run the inference.py but the error told me CUDA error: out of memory,Obviously my gpu is not overloaded. I think it is because the gpu specified by me is invalid. Does anyone have the same problem and how to solve it? I would be very grateful.

Traceback (most recent call last):
  File "inference.py", line 145, in <module>
    main(args)
  File "inference.py", line 88, in main
    result = animate_from_coeff.generate(data, save_dir, pic_path, crop_info, \
  File "/home/wangjh/test/SadTalker/src/facerender/animate.py", line 183, in generate
    predictions_video = make_animation(source_image, source_semantics, target_semantics,
  File "/home/wangjh/test/SadTalker/src/facerender/modules/make_animation.py", line 109, in make_animation
    kp_canonical = kp_detector(source_image)
  File "/home/wangjh/anaconda3/envs/sadtalker/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/wangjh/test/SadTalker/src/facerender/modules/keypoint_detector.py", line 68, in forward
    out = self.gaussian2kp(heatmap)
  File "/home/wangjh/test/SadTalker/src/facerender/modules/keypoint_detector.py", line 50, in gaussian2kp
    grid = make_coordinate_grid(shape[2:], heatmap.type()).unsqueeze_(0).unsqueeze_(0)
  File "/home/wangjh/test/SadTalker/src/facerender/modules/util.py", line 56, in make_coordinate_grid
    x = torch.arange(w).type(type)
RuntimeError: CUDA error: out of memory
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

and i change the python :

    if torch.cuda.is_available() and not args.cpu:
        args.device = "cuda:5"
    else:
    args.device = "cpu"
SuperGoodGame commented 10 months ago

i use cpu is ok,and gpu do the steps before face Face Renderer is ok

SuperGoodGame commented 10 months ago

RuntimeError: CUDA error: out of memory kp_canonical = kp_detector(source_image) 为什么提取人脸点 显存爆炸

shareholdr commented 9 months ago

Do this instead of hussle with the local version, full guide on how to get the Google colab variant to work here https://vm.tiktok.com/ZGeLNu2yq/