Is there an existing issue for this?
What would your feature do ?
Currently, the model checkpoints from the Hugging Face (HF) Hub are downloaded using the following
|
dl = load_file_from_url(model_url, model_path, True, download_name) |
The HF team provides a separate library called huggingface_hub that lets anyone seamlessly interact with the HF Hub and its files. It comes packed with support for caching as well. So, I was wondering if we should consider refactoring this with huggingface_hub.
Proposed workflow
If a user enters, say, andite/anything-v4.0 (a repository on the HF Hub), we would automatically download this checkpoint and cache it. An option for downloading a specific checkpoint can also be added.
The code for this is relatively quite simple:
import huggingface_hub as hub
repo_id = "andite/anything-v4.0"
filename = "anything-v4.0.ckpt"
file_path = hub.hf_hub_download(repo_id, filename)
Here are some number on loading a checkpoint:
Without caching:
CPU times: user 14.3 s, sys: 14.2 s, total: 28.5 s
Wall time: 1min 59s
With caching:
CPU times: user 380 ms, sys: 48.7 ms, total: 428 ms
Wall time: 682 ms
Additional information
Cc: @patrickvonplaten
Is there an existing issue for this?
What would your feature do ?
Currently, the model checkpoints from the Hugging Face (HF) Hub are downloaded using the following
stable-diffusion-webui/modules/modelloader.py
Line 62 in 0cc0ee1
The HF team provides a separate library called
huggingface_hubthat lets anyone seamlessly interact with the HF Hub and its files. It comes packed with support for caching as well. So, I was wondering if we should consider refactoring this withhuggingface_hub.Proposed workflow
If a user enters, say,
andite/anything-v4.0(a repository on the HF Hub), we would automatically download this checkpoint and cache it. An option for downloading a specific checkpoint can also be added.The code for this is relatively quite simple:
Here are some number on loading a checkpoint:
Without caching:
With caching:
Additional information
Cc: @patrickvonplaten