Model loading is slow / Time before generating
See original GitHub issueDescribe the bug
I have used a simple realization on T4 (Google Cloud)
import torch
from torch import autocast
from diffusers import StableDiffusionPipeline
access_token = ""
pipe = StableDiffusionPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4",
revision="fp16",
torch_dtype=torch.float16,
use_auth_token=access_token,
)
pipe = pipe.to("cuda")
prompt = "a photo of an astronaut riding a horse on mars"
image = pipe(prompt).images[0]
image.save("astronaut_rides_horse_1.png")
And generating can take 10-15 sec per image - it’s good result. But we have a problem with time before start of generating. Pre-loading models and files can take ~ 30 sec. For example:
How we can speed up the preloading?
Reproduction
No response
Logs
No response
System Info
Google Cloud - T4
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
[model_utils] very slow model instantiation #9205 - GitHub
For some reason I'm noticing a very slow model instantiation time. For example to load shleifer/distill-mbart-en-ro-12-4 it takes.
Read more >Extremely slow model load with keras - python - Stack Overflow
When I try to load them, using load_model , the time required for each model is quite large and incremental. The loading is...
Read more >OpenGL ES model loader is slow?
The fastest model loading basically happens when you can memory-map a binary file and pass the resulting pointer, with unmodified/un-parsed data ...
Read more >Handling big models - Hugging Face
Load those weights inside the model. While this works very well for regularly sized models, this workflow has some clear limitations when we...
Read more >Investigating Slow View Load Requests - Tableau Help
The Slow View Load Requests chart shows when views are rendering more slowly than normal on Tableau Server. To do this, the chart...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@patrickvonplaten nice! This was a sife effect I didn’t think of when I was implementing it.
hm… thank you! It improved the time. A delay stay about 10-11 sec now. + 11 sec per image generating.