Haoming02 / sd-webui-old-photo-restoration

An Extension for Automatic1111 Webui for Bringing Old Photo Back to Life
MIT License
108 stars 6 forks source link

Non-Windows Environment - Torch not compiled with CUDA enabled #3

Closed TheClassyTurkey closed 9 months ago

TheClassyTurkey commented 9 months ago

Apologies, I was busy over the holiday and just saw you had tried to fix this issue. I can't reopen the previous issue as I am not a collaborator so I had to create a new one and reference this one.

I pulled the latest commit and am now seeing this error.

Running Stage 1: Overall restoration
initializing the dataloader
model weights loaded
directory of testing image: /somelocation/Documents/photorestore-test
processing photo-restoration-example-001-before.jpg
Traceback (most recent call last):
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "/somelocationDocuments/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/extensions/sd-webui-old-photo-restoration/scripts/main_function.py", line 142, in bop
    final_output = core_functions(input_path, output_path, gpu_id, scratch, hr, face_res)
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/extensions/sd-webui-old-photo-restoration/scripts/main_function.py", line 74, in core_functions
    global_detection(args)
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/extensions/sd-webui-old-photo-restoration/Global/detection.py", line 179, in global_detection
    main(config)
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/extensions/sd-webui-old-photo-restoration/Global/detection.py", line 146, in main
    scratch_image_scale = scratch_image_scale.to(config.GPU)
  File "/somelocation/Documents/SD-Main/stable-diffusion-webui/venv/lib/python3.10/site-packages/torch/cuda/__init__.py", line 239, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

Another thing I noticed was that this message was displayed every time I launch SD. I know there is another issue open related to the "Installing requirements" message appearing.

Python 3.10.13 (main, Aug 24 2023, 22:36:46) [Clang 14.0.3 (clang-1403.0.22.14.1)]
Version: v1.6.0
Commit hash: 5ef669de080814067961f28357256e8fe27544f4
Installing Requirements for Bringing-Old-Photos-Back-to-Life...
Installing Old-Photo-Restoration Requirement: scikit-image
Installing Old-Photo-Restoration Requirement: PyYAML
Installing Old-Photo-Restoration Requirement: opencv-python

Originally posted by @TheClassyTurkey in https://github.com/Haoming02/sd-webui-old-photo-restoration/issues/1#issuecomment-1875882159

Haoming02 commented 9 months ago

Guess there are still many GPU assignments that I missed...

For the second issue, I see you're still using v1.6.0 of the Webui. The repeated installation has been fixed in v1.7.0 of Webui, as they changed how the is_installed function works.

Haoming02 commented 9 months ago

Should hopefully work for non-CUDA devices now...

TheClassyTurkey commented 9 months ago

This issue has now been resolved. Thank you for your time on getting this working.