Loading the Diffusers model
Instead of downloading model files manually, the Hugging Face Diffusers package provides a convenient way to access open source model files from a string-type model ID like this:
import torch from diffusers import StableDiffusionPipeline pipe = StableDiffusionPipeline.from_pretrained( Â Â Â Â "runwayml/stable-diffusion-v1-5", Â Â Â Â torch_dtype = torch.float16 )
When the preceding code is executed, if Diffusers can’t find the model files that are denoted by the model ID, the package will automatically reach out to the Hugging Face repository to download the model files and store them in a cache folder for next time.
By default, the cache files will be stored in the following places:
Windows:
C:\Users\user_name\.cache\huggingface\hub
Linux:
\
home\user_name\.cache\huggingface\hub
Using the default cache path is fine in the beginning, however, if your system driver is less than 512 GB...