Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

huggingface download error #5

Open
junyizeng opened this issue Jun 5, 2023 · 6 comments
Open

huggingface download error #5

junyizeng opened this issue Jun 5, 2023 · 6 comments

Comments

@junyizeng
Copy link

Thank you very much for your open source, I have encountered the following problem with the pre-trained diffusion model from huggingface.

Traceback (most recent call last):
File "/root/code/DiffAttack-main/main.py", line 107, in
ldm_stable = StableDiffusionPipeline.from_pretrained(pretrained_diffusion_path).to('cuda:0')
File "/root/miniconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py", line 884, in from_pretrained
cached_folder = cls.download(
File "/root/miniconda3/envs/ldm/lib/python3.8/site-packages/diffusers/pipelines/pipeline_utils.py", line 1208, in download
config_file = hf_hub_download(
File "/root/miniconda3/envs/ldm/lib/python3.8/site-packages/huggingface_hub/utils/_validators.py", line 120, in _inner_fn
return fn(*args, **kwargs)
File "/root/miniconda3/envs/ldm/lib/python3.8/site-packages/huggingface_hub/file_download.py", line 1259, in hf_hub_download
raise LocalEntryNotFoundError(
huggingface_hub.utils._errors.LocalEntryNotFoundError: Connection error, and we cannot find the requested files in the disk cache. Please try again or make sure your Internet connection is on.

@WindVChen
Copy link
Owner

Hi @junyizeng ,

It seems that there is a problem with the Internet connection. Maybe you can check some possible solutions here.

@junyizeng
Copy link
Author

Thank you very much for your quick reply. Due to the limitation of the device, I am renting the online calculator platform (AutoDL) to run the code, but the file downloaded by stable_diffusion is too large and the system disk is easily filled up, which affects the normal operation of the code. Can I download the files needed to load stable_diffuion in advance and import the model from local? Since this is my first time to use huggingface, could you please provide a tutorial if possible?

@WindVChen
Copy link
Owner

Since I'm unfamiliar with AutoDL platform, I'm unsure whether the way I run it with local files will bring some inspiration.

You can first download the files by directly running the following codes on the local machine:

from diffusers import StableDiffusionPipeline
ldm_stable = StableDiffusionPipeline.from_pretrained(“stabilityai/stable-diffusion-2-base”)

Then, you can find these files in the local path (take Win10 as an example): C:\Users\$YourName$\.cache\huggingface\diffusers\models--stabilityai--stable-diffusion-2-base\snapshots\$A Long Serial Number$.

After that, you can directly load the local files without again downloading from the Internet:

from diffusers import StableDiffusionPipeline
ldm_stable = StableDiffusionPipeline.from_pretrained("C:\Users\$YourName$\.cache\huggingface\diffusers\models--stabilityai--stable-diffusion-2-base\snapshots\$A Long Serial Number$")

@junyizeng
Copy link
Author

Thank you very much, the method you gave is effective!

@yuuma002
Copy link

Hi. Thanks for open-sourcing the code of your wonderful work. I met the same error and I cannot fix the error by huggingface/transformers#10067. Could you provide the detailed fixing method of the issue @WindVChen?

Hi @junyizeng ,

It seems that there is a problem with the Internet connection. Maybe you can check some possible solutions here.

@WindVChen
Copy link
Owner

Hi @yuuma002 ,

Thanks for your attention. If still fail to download the weight automatically, maybe you can try to download it manually. Try to download all the files here (no need to download 512-base-ema.ckpt and 512-base-ema.safetensors) and save them into a directory (let us name it as A), then you can try to load the weight by:

from diffusers import StableDiffusionPipeline
ldm_stable = StableDiffusionPipeline.from_pretrained(A)

Hope this can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants