invoke-ai / InvokeAI

Invoke is a leading creative engine for Stable Diffusion models, empowering professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry leading WebUI, and serves as the foundation for multiple commercial products.
https://invoke-ai.github.io/InvokeAI/
Apache License 2.0
23.34k stars 2.4k forks source link

[bug]: MacOs: main branch : upscale is broken #2658

Closed i3oc9i closed 1 year ago

i3oc9i commented 1 year ago

Is there an existing issue for this?

OS

macOS

GPU

mps

VRAM

128G

What happened?

in the main branch, commit 0bc55a0d (HEAD -> main, origin/main, origin/HEAD) Fix link to the installation documentation when using the web-ui, the new upscale produce the following issue ...

* --web was specified, starting web server...
* Initializing, be patient...
>> Initialization file /Users/ivano/Code/Ai/@Stuffs/invokeai.models/invokeai.init found. Loading...
>> Started Invoke AI Web Server!
>> Default host address now 127.0.0.1 (localhost). Use --host 0.0.0.0 to bind any address.
>> Point your browser at http://127.0.0.1:9090
>> System config requested
objc[7130]: Class CaptureDelegate is implemented in both /Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/cv2/cv2.abi3.so (0x13d27a4d0) and /opt/homebrew/Cellar/opencv/4.7.0_1/lib/libopencv_videoio.4.7.0.dylib (0x2d81d8880). One of the two will be used. Which one is undefined.
objc[7130]: Class CVWindow is implemented in both /Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/cv2/cv2.abi3.so (0x13d27a520) and /opt/homebrew/Cellar/opencv/4.7.0_1/lib/libopencv_highgui.4.7.0.dylib (0x2d8048b10). One of the two will be used. Which one is undefined.
objc[7130]: Class CVView is implemented in both /Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/cv2/cv2.abi3.so (0x13d27a548) and /opt/homebrew/Cellar/opencv/4.7.0_1/lib/libopencv_highgui.4.7.0.dylib (0x2d8048b38). One of the two will be used. Which one is undefined.
objc[7130]: Class CVSlider is implemented in both /Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/cv2/cv2.abi3.so (0x13d27a570) and /opt/homebrew/Cellar/opencv/4.7.0_1/lib/libopencv_highgui.4.7.0.dylib (0x2d8048b60). One of the two will be used. Which one is undefined.
>> Patchmatch initialized
>> Postprocessing requested for "outputs/001689.f39c230f.2517143341.png": {'type': 'esrgan', 'upscale': [4, 0.75, 0.75]}
>> Error loading Real-ESRGAN:
Traceback (most recent call last):
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/ldm/invoke/restoration/realesrgan.py", line 52, in process
    upsampler = self.load_esrgan_bg_upsampler(denoise_str)
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/ldm/invoke/restoration/realesrgan.py", line 33, in load_esrgan_bg_upsampler
    bg_upsampler = RealESRGANer(
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/realesrgan/utils.py", line 57, in __init__
    loadnet = self.dni(model_path[0], model_path[1], dni_weight)
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/realesrgan/utils.py", line 83, in dni
    net_b = torch.load(net_b, map_location=torch.device(loc))
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/torch/serialization.py", line 771, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/torch/serialization.py", line 270, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/torch/serialization.py", line 251, in __init__
    super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/ivano/Code/Ai/@Stuffs/invokeai.models/models/realesrgan/realesr-general-wdn-x4v3.pth'

>> Real-ESRGAN Upscaling seed:2517143341, scale:4x, tile:400, denoise:0.75

Traceback (most recent call last):
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/invokeai/backend/invoke_ai_web_server.py", line 680, in handle_run_postprocessing
    image = self.esrgan.process(
  File "/Users/ivano/Code/Ai/@Stuffs/invokeai.models/.venv/lib/python3.10/site-packages/ldm/invoke/restoration/realesrgan.py", line 73, in process
    output, _ = upsampler.enhance(
UnboundLocalError: local variable 'upsampler' referenced before assignment

Screenshots

Screen Shot 2023-02-14 at 10 08 43 AM

Additional context

No response

Contact Details

No response

psychedelicious commented 1 year ago

This should be fixed if you run invokeai-configure. You can skip the main model downloads. There is an updated esrgan model which will be downloaded by the support model downloaded which will run automatically after you skip.

i3oc9i commented 1 year ago

yes running invokeai-configure update the model and solve the issue, thank you