stable-diffusion-webui
stable-diffusion-webui copied to clipboard
use empty_like to reduce model loading time
use empty_like() instead of zeros_like() in the LoadStateDictOnMeta() we don't have to initialize params with zeros, It will be overwrittened by param.copy_(input_param), (https://github.com/pytorch/pytorch/blob/main/torch/nn/modules/module.py#L2441 )
Checklist:
- [x] I have read contributing wiki page
- [x] I have performed a self-review of my own code
- [x] My code follows the style guidelines
- [x] My code passes tests
I merged this into my fork a few months ago without issue.
Didn't test actual model load times to see if there was a difference, but I can say for certain that it didn't slow anything! https://github.com/aleph23/auto1111/pull/5