-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Cannot change pre-trained-model download directory #2614
Comments
Hey @xingzhehe, Can you just try to use the
(sorry for some reason our docs don't display it atm - will check) |
You can see the |
Thanks! but after I set cache_dir=".", it seems not to be able to find some config file: Traceback (most recent call last): |
Hmm that's weird what happens if you set |
It gives the same error. |
I encountered a similar situation and solved my problem by using symbolic link.
Hope it helps. |
Yes it helps! Thank you so much! But I really think this is a bug and should be fixed. |
Hmm I really cannot reproduce this - @Wauplin do you have an idea maybe what could be going on here? Also @xingzhehe, could you please post what error message you get when doing: import torch
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16, cache_dir="./cache_dir") |
@xingzhehe sorry about that. It is related to a bug introduced by latest huggingface_hub release. I'm working on fixing it and will keep you updated once published. In the meantime you can either downgrade huggingface_hub to 0.12.1 or set an absolute path for cache_dir (e.g. Related issue: huggingface/huggingface_hub#1388 |
Hi @xingzhehe, I made a patch release to fix this (see release notes). |
Thanks! The issue has been fixed! |
Please simply use # Export the TRANSFORMERS_CACHE, HF_HOME, and HF_DATASETS_CACHE paths
export TRANSFORMERS_CACHE=/projectnb/pnn/.cache
export HF_HOME=/projectnb/pnn/.cache
export HF_DATASETS_CACHE=/projectnb/pnn/.cache or import os
os.environ['TRANSFORMERS_CACHE'] = "/projectnb/pnn/.cache"
os.environ['HF_HOME'] = "/projectnb/pnn/.cache"
os.environ['HF_DATASETS_CACHE'] = "/projectnb/pnn/.cache" |
Describe the bug
I tried the very first example Text-to-Image generation with Stable Diffusion.
I have set every single variable I can find on Internet to the current path, but it keeps downloading model to
~/.cache
. I have very limited home space, so it keeps telling me no space on the disk.Reproduction
import torch
from diffusers import StableDiffusionPipeline
import os
os.environ['TORCH_HOME'] = os.path.abspath(os.getcwd())
os.environ['HF_HOME'] = os.path.abspath(os.getcwd())
os.environ['XDG_CACHE_HOME'] = os.path.abspath(os.getcwd())
os.environ['HUGGINGFACE_HUB_CACHE'] = os.path.abspath(os.getcwd())
os.environ['TRANSFORMERS_CACHE'] = os.path.abspath(os.getcwd())
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
pipe = pipe.to("cuda")
prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt).images[0]
Logs
No response
System Info
I am using ubuntu 20.04, and the latest diffuser.
The text was updated successfully, but these errors were encountered: