Commit 6ad666e4 authored by AUTOMATIC1111's avatar AUTOMATIC1111

more changes for #13865: fix formatting, rename the function, add comment and add a readme entry

parent 80d639a4
...@@ -91,6 +91,7 @@ A browser interface based on Gradio library for Stable Diffusion. ...@@ -91,6 +91,7 @@ A browser interface based on Gradio library for Stable Diffusion.
- Eased resolution restriction: generated image's dimensions must be a multiple of 8 rather than 64 - Eased resolution restriction: generated image's dimensions must be a multiple of 8 rather than 64
- Now with a license! - Now with a license!
- Reorder elements in the UI from settings screen - Reorder elements in the UI from settings screen
- [Segmind Stable Diffusion](https://huggingface.co/segmind/SSD-1B) support
## Installation and Running ## Installation and Running
Make sure the required [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) are met and follow the instructions available for: Make sure the required [dependencies](https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Dependencies) are met and follow the instructions available for:
......
...@@ -184,17 +184,19 @@ class StableDiffusionModelHijack: ...@@ -184,17 +184,19 @@ class StableDiffusionModelHijack:
errors.display(e, "applying cross attention optimization") errors.display(e, "applying cross attention optimization")
undo_optimizations() undo_optimizations()
def conv_ssd(self, m): def convert_sdxl_to_ssd(self, m):
delattr(m.model.diffusion_model.middle_block, '1') """Converts an SDXL model to a Segmind Stable Diffusion model (see https://huggingface.co/segmind/SSD-1B)"""
delattr(m.model.diffusion_model.middle_block, '2')
for i in ['9','8','7','6','5','4']: delattr(m.model.diffusion_model.middle_block, '1')
delattr(m.model.diffusion_model.input_blocks[7][1].transformer_blocks,i) delattr(m.model.diffusion_model.middle_block, '2')
delattr(m.model.diffusion_model.input_blocks[8][1].transformer_blocks,i) for i in ['9', '8', '7', '6', '5', '4']:
delattr(m.model.diffusion_model.output_blocks[0][1].transformer_blocks,i) delattr(m.model.diffusion_model.input_blocks[7][1].transformer_blocks, i)
delattr(m.model.diffusion_model.output_blocks[1][1].transformer_blocks,i) delattr(m.model.diffusion_model.input_blocks[8][1].transformer_blocks, i)
delattr(m.model.diffusion_model.output_blocks[4][1].transformer_blocks,'1') delattr(m.model.diffusion_model.output_blocks[0][1].transformer_blocks, i)
delattr(m.model.diffusion_model.output_blocks[5][1].transformer_blocks,'1') delattr(m.model.diffusion_model.output_blocks[1][1].transformer_blocks, i)
devices.torch_gc() delattr(m.model.diffusion_model.output_blocks[4][1].transformer_blocks, '1')
delattr(m.model.diffusion_model.output_blocks[5][1].transformer_blocks, '1')
devices.torch_gc()
def hijack(self, m): def hijack(self, m):
conditioner = getattr(m, 'conditioner', None) conditioner = getattr(m, 'conditioner', None)
......
...@@ -357,7 +357,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer ...@@ -357,7 +357,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer
sd_models_xl.extend_sdxl(model) sd_models_xl.extend_sdxl(model)
if model.is_ssd: if model.is_ssd:
sd_hijack.model_hijack.conv_ssd(model) sd_hijack.model_hijack.convert_sdxl_to_ssd(model)
if shared.opts.sd_checkpoint_cache > 0: if shared.opts.sd_checkpoint_cache > 0:
# cache newly loaded model # cache newly loaded model
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment