rupeshs / fastsdcpu

Fast stable diffusion on CPU
MIT License
1.43k stars 115 forks source link

Controlnet not working #240

Closed lysergik closed 1 month ago

lysergik commented 1 month ago

Hi, I setup fastsd it works pretty well however the controlnet seems broken, I tried with various model(which I downloaded fromt the repo indicated in the doc) and either the image generation goes without taking into account the controlnet, like the loog indicate when generating : controlnet': {'adapter_path': '/home/ubuntu/fastsdcpu/controlnet_models/softedges.safetensors', 'conditioning_scale': 1, 'enabled': False}, And I also get that after image generation : /home/ubuntu/venv/lib/python3.10/site-packages/pydantic/main.py:364: UserWarning: Pydantic serializer warnings: ExpectedUnion[definition-ref, list[definition-ref]]but gotControlNetSetting- serialized value may not be as expected return self.__pydantic_serializer__.to_python(

Also when trying using canny preprocessor I get some traceback : `Traceback (most recent call last):
File "/home/ubuntu/venv/lib/python3.10/site-packages/diffusers/configuration_utils.py", line 379, in load_config
config_file = hf_hub_download(
File "/home/ubuntu/venv/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f
return f(*args, *kwargs) File "/home/ubuntu/venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(args, **kwargs) File "/home/ubuntu/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1240, in hf_hub_download return _hf_hub_download_to_cache_dir( File "/home/ubuntu/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1347, in _hf_hub_download_to_cache_dir _raise_on_head_call_error(head_call_error, force_download, local_files_only) File "/home/ubuntu/venv/lib/python3.10/site-packages/huggingface_hub/file_download.py", line 1848, in _raise_on_head_call_error raise LocalEntryNotFoundError( huggingface_hub.utils._errors.LocalEntryNotFoundError: Cannot find the requested files in the disk cache and outgoing traffic has been disabled. To enable hf.co look-ups and downloads online, set 'local_files_only' to False.

During handling of the above exception, another exception occurred: `

and

raceback (most recent call last): File "/home/ubuntu/venv/lib/python3.10/site-packages/gradio/queueing.py", line 501, in call_prediction output = await route_utils.call_process_api( File "/home/ubuntu/venv/lib/python3.10/site-packages/gradio/route_utils.py", line 258, in call_process_api output = await app.get_blocks().process_api( File "/home/ubuntu/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1684, in process_api result = await self.call_function( File "/home/ubuntu/venv/lib/python3.10/site-packages/gradio/blocks.py", line 1250, in call_function prediction = await anyio.to_thread.run_sync( File "/home/ubuntu/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync return await get_async_backend().run_sync_in_worker_thread( File "/home/ubuntu/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread return await future File "/home/ubuntu/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run File "/home/ubuntu/venv/lib/python3.10/site-packages/gradio/utils.py", line 750, in wrapper response = f(*args, **kwargs) File "/home/ubuntu/fastsdcpu/src/frontend/webui/text_to_image_ui.py", line 54, in generate_text_to_image images = future.result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result return self.__get_result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/home/ubuntu/fastsdcpu/src/context.py", line 55, in generate_text_to_image self.lcm_text_to_image.init( File "/home/ubuntu/fastsdcpu/src/backend/lcm_text_to_image.py", line 174, in init controlnet_args = load_controlnet_adapters(lcm_diffusion_setting) File "/home/ubuntu/fastsdcpu/src/backend/controlnet.py", line 24, in load_controlnet_adapters controlnet_adapter = ControlNetModel.from_single_file( File "/home/ubuntu/venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/home/ubuntu/venv/lib/python3.10/site-packages/diffusers/loaders/single_file_model.py", line 268, in from_single_file diffusers_model_config = cls.load_config( File "/home/ubuntu/venv/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/home/ubuntu/venv/lib/python3.10/site-packages/diffusers/configuration_utils.py", line 406, in load_config raise EnvironmentError( OSError: runwayml/stable-diffusion-v1-5 does not appear to have a file named config.json. Note that local file only isn't activated, so I don't know why the programs tell me that.

rupeshs commented 1 month ago

@lysergik Thanks for reporting it seems like latest diffusers is causing this issue.

rupeshs commented 1 month ago

@lysergik Fixed in the latest release https://github.com/rupeshs/fastsdcpu/releases/tag/v1.0.0-beta.37