bes-dev / stable_diffusion.openvino

Apache License 2.0
1.54k stars 206 forks source link

hf_hub_download seems to get an invalid argument #154

Open zoldseges opened 1 year ago

zoldseges commented 1 year ago

$ python demo.py --prompt "Street-art painting of Emilia Clarke in style of Banksy, photorealism"

Traceback (most recent call last): File "C:\repos\stable_diffusion.openvino\demo.py", line 83, in main(args) File "C:\repos\stable_diffusion.openvino\demo.py", line 35, in main engine = StableDiffusionEngine( File "C:\repos\stable_diffusion.openvino\stable_diffusion_engine.py", line 34, in init hf_hub_download(repo_id=model, filename="text_encoder.xml"), File "C:\Users\paada\AppData\Local\Programs\Python\Python39\lib\site-packages\huggingface_hub\file_download.py", line 1232, in hf_hub_download with FileLock(lock_path): File "C:\Users\paada\AppData\Local\Programs\Python\Python39\lib\site-packages\filelock_api.py", line 255, in enter self.acquire() File "C:\Users\paada\AppData\Local\Programs\Python\Python39\lib\site-packages\filelock_api.py", line 213, in acquire self._acquire() File "C:\Users\paada\AppData\Local\Programs\Python\Python39\lib\site-packages\filelock_windows.py", line 27, in _acquire fd = os.open(self.lock_file, flags, self._context.mode) OSError: [Errno 22] Invalid argument: 'C:\Users\paada/.cache\huggingface\hub\models--bes-dev--stable-diffusion-v1-4-openvino\blobs\W/"18427dfd350d372b46e0f97328cd81bc3e11ca78.lock'

I'm not sure what's going on here, but there's a ` " ' in the path. The directory is empty, I don't know if that's relevant. Also, the path uses \ and / inconsistently, I don't know if that could cause an issue. From the path you can guess that i'm on windows.

brmarkus commented 1 year ago

Can you provide more details about your environment, how you installed this repo? MS-Win - is it v10 or v11? Python in version 3.9? Have you done any code-changes? Is it the first time you try to run the code, or was it working before?

brmarkus commented 1 year ago

Now I just tried to install and run it in a clean environment:

MS-Win 10 Python v3.8.8

New Python virt-env. Updated PIP. Followed the steps under "https://github.com/bes-dev/stable_diffusion.openvino#install-requirements".

And I get the same problem (in a CMD prompt without admin-rights):

$>python demo.py --prompt "Street-art painting of Emilia Clarke in style of Banksy, photorealism"
Downloading: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 905/905 [00:00<?, ?B/s]
Downloading: 939kB [00:00, 12.5MB/s]
Downloading: 512kB [00:00, 2.69MB/s]
Downloading: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 389/389 [00:00<?, ?B/s]
Downloading: 2.12MB [00:00, 6.11MB/s]
Traceback (most recent call last):
  File "demo.py", line 83, in <module>
    main(args)
  File "demo.py", line 35, in main
    engine = StableDiffusionEngine(
  File "C:\stable_diffusion.openvino\stable_diffusion_engine.py", line 34, in __init__
    hf_hub_download(repo_id=model, filename="text_encoder.xml"),
  File "C:\virtenv\lib\site-packages\huggingface_hub\file_download.py", line 1232, in hf_hub_download
    with FileLock(lock_path):
  File "C:\virtenv\lib\site-packages\filelock\_api.py", line 255, in __enter__
    self.acquire()
  File "C:\virtenv\lib\site-packages\filelock\_api.py", line 213, in acquire
    self._acquire()
  File "C:\virtenv\lib\site-packages\filelock\_windows.py", line 27, in _acquire
    fd = os.open(self.lock_file, flags, self._context.mode)
OSError: [Errno 22] Invalid argument: 'C:\\Users\\me/.cache\\huggingface\\hub\\models--bes-dev--stable-diffusion-v1-4-openvino\\blobs\\W/"18427dfd350d372b46e0f97328cd81bc3e11ca78.lock'

This is strange. According to the console logs something big got downloaded - but under "C:\Users\me/.cache\huggingface\" there are no bigger files.

It worked for my before - but longer ago.