stable-diffusion-webui
stable-diffusion-webui copied to clipboard
Improved default handling
Description
- using get with a default value directly in the attribute assignment simplifies the code and avoids the need for conditional checks later
- self.alpha = weights.w.get("alpha", None) # alpha is constraint >>> self.rescale = weights.w.get('rescale', torch.tensor([1.0]))
- reduce redundancy
Screenshots/videos:
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