PhotoMaker icon indicating copy to clipboard operation
PhotoMaker copied to clipboard

cannot import name 'LocalContext' from 'gradio.context'

Open rizkidewanto opened this issue 1 year ago • 6 comments

Hello. First of all, I want to say congrats to the dev. What an AI. I try the demo on HF, it's 🤯 I want to try running this locally, but encounter this error :

Traceback (most recent call last):
  File "D:\WPy64-31090\notebooks\pm\app.py", line 10, in <module>
    import spaces
  File "D:\WPy64-31090\python-3.10.9.amd64\lib\site-packages\spaces\__init__.py", line 10, in <module>
    from .zero.decorator import GPU
  File "D:\WPy64-31090\python-3.10.9.amd64\lib\site-packages\spaces\zero\decorator.py", line 17, in <module>
    from . import client
  File "D:\WPy64-31090\python-3.10.9.amd64\lib\site-packages\spaces\zero\client.py", line 17, in <module>
    from .gradio import get_event
  File "D:\WPy64-31090\python-3.10.9.amd64\lib\site-packages\spaces\zero\gradio.py", line 8, in <module>
    from gradio.context import LocalContext
ImportError: cannot import name 'LocalContext' from 'gradio.context'

Help is appreciated, thanks.

rizkidewanto avatar Jan 21 '24 08:01 rizkidewanto

Using this project to run it on Windows: https://github.com/bmaltais/PhotoMaker/tree/v1.0.1

Paper99 avatar Jan 21 '24 11:01 Paper99

Ok, will notify if anything goes wrong again. Thanks.

rizkidewanto avatar Jan 21 '24 12:01 rizkidewanto

Ok, I got it running on Colab (sad PC can't run it). However, I got message torch.cuda.OutOfMemoryError: CUDA out of memory. How to fix it?

rizkidewanto avatar Jan 23 '24 03:01 rizkidewanto

The minimum GPU memory required by our PhotoMaker is 15G. You could apply other GPU

Paper99 avatar Jan 23 '24 07:01 Paper99

An important note: For those GPUs that do not support bfloat16, please change this line to torch_dtype = torch.float16, the speed will be greatly improved (1min/img (before) vs. 14s/img (after) on V100). The minimum GPU memory requirement for PhotoMaker is 15G.

Paper99 avatar Jan 23 '24 07:01 Paper99

Um, can I run it if I have this spec? image

rizkidewanto avatar Jan 23 '24 07:01 rizkidewanto