InvokeAI: Codeformer face restoration fails - Placeholder storage has not been allocated on MPS device

Describe your environment

  • GPU: mps
  • VRAM: [if known]
  • CPU arch: arm
  • OS: macOS
  • Python: Anaconda
  • Branch: development

Describe the bug Using Codeformer face restoration fails with the following error:

Error running RealESRGAN or GFPGAN. Your image was not upscaled. Placeholder storage has not been allocated on MPS device!

This is on an M1 Mac, freshly updated environment.

To Reproduce Use the following prompt: superman portrait -G 1.0 -ft codeformer

Additional context Not sure if useful but a stack trace of the error:

  File "/Users/andy/dev/mac/StableDiffusion/stable-diffusion/ldm/generate.py", line 548, in upscale_and_reconstruct
    image = CodeFormerRestoration().process(image=image, strength=strength, device=self.device, seed=seed, fidelity=codeformer_fidelity)
  File "/Users/andy/dev/mac/StableDiffusion/stable-diffusion/ldm/restoration/codeformer/codeformer.py", line 40, in process
    face_helper.get_face_landmarks_5(resize=640, eye_dist_threshold=5)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/facexlib/utils/face_restoration_helper.py", line 139, in get_face_landmarks_5
    bboxes = self.face_det.detect_faces(input_img, 0.97) * scale
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/facexlib/detection/retinaface.py", line 205, in detect_faces
    loc, conf, landmarks, priors = self.__detect_faces(image)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/facexlib/detection/retinaface.py", line 156, in __detect_faces
    loc, conf, landmarks = self(inputs)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/facexlib/detection/retinaface.py", line 121, in forward
    out = self.body(inputs)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/torchvision/models/_utils.py", line 69, in forward
    x = module(x)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/torch/nn/modules/batchnorm.py", line 168, in forward
    return F.batch_norm(
  File "/Users/andy/.asdf/installs/python/anaconda3-2022.05/envs/ldm/lib/python3.10/site-packages/torch/nn/functional.py", line 2438, in batch_norm
    return torch.batch_norm(
RuntimeError: Placeholder storage has not been allocated on MPS device!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments