docstr: Converts an SDXL model to a Segmind Stable Diffusion model (see https://huggingface.co/segmind/SSD-1B)
docstr_tok: ["Converts","an","SDXL","model","to","a","Segmind","Stable","Diffusion","model","(","see","https",":","\/\/huggingface.co\/segmind\/SSD-1B",")"]
code: def convert_sdxl_to_ssd(self, m):
      """Converts an SDXL model to a Segmind Stable Diffusion model (see https://huggingface.co/segmind/SSD-1B)"""
  
      delattr(m.model.diffusion_model.middle_block, "1")
      delattr(m.model.diffusion_model.middle_block, "2")
      for i in ["9", "8", "7", "6", "5", "4"]:
          delattr(
              m.model.diffusion_model.input_blocks[7][
                  1
              ].transformer_blocks,
              i,
          )
          delattr(
              m.model.diffusion_model.input_blocks[8][
                  1
              ].transformer_blocks,
              i,
          )
          delattr(
              m.model.diffusion_model.output_blocks[0][
                  1
              ].transformer_blocks,
              i,
          )
          delattr(
              m.model.diffusion_model.output_blocks[1][
                  1
              ].transformer_blocks,
              i,
          )
      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()
  
imports: import torch
  from torch.nn.functional import silu
  from types import MethodType
  from modules import devices, sd_hijack_optimizations, shared, script_callbacks, errors, sd_unet, patches
  from modules.hypernetworks import hypernetwork
  from modules.shared import cmd_opts
  from modules import sd_hijack_clip, sd_hijack_open_clip, sd_hijack_unet, sd_hijack_xlmr, xlmr, xlmr_m18
  import ldm.modules.attention
  import ldm.modules.diffusionmodules.model
  import ldm.modules.diffusionmodules.openaimodel
  import ldm.models.diffusion.ddpm
  import ldm.models.diffusion.ddim
  import ldm.models.diffusion.plms
  import ldm.modules.encoders.modules
  import sgm.modules.attention
  import sgm.modules.diffusionmodules.model
  import sgm.modules.diffusionmodules.openaimodel
  import sgm.modules.encoders.modules
label_desc: Use image node_id 3 for calling the StableDiffusionModelHijack obj's underlying member method code with example usage: obj.convert_sdxl_to_ssd(m) without return types