shared_items.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. def realesrgan_models_names():
  2. import modules.realesrgan_model
  3. return [x.name for x in modules.realesrgan_model.get_realesrgan_models(None)]
  4. def postprocessing_scripts():
  5. import modules.scripts
  6. return modules.scripts.scripts_postproc.scripts
  7. def sd_vae_items():
  8. import modules.sd_vae
  9. return ["Automatic", "None"] + list(modules.sd_vae.vae_dict)
  10. def refresh_vae_list():
  11. import modules.sd_vae
  12. modules.sd_vae.refresh_vae_list()
  13. def cross_attention_optimizations():
  14. import modules.sd_hijack
  15. return ["Automatic"] + [x.title() for x in modules.sd_hijack.optimizers] + ["None"]
  16. def sd_unet_items():
  17. import modules.sd_unet
  18. return ["Automatic"] + [x.label for x in modules.sd_unet.unet_options] + ["None"]
  19. def refresh_unet_list():
  20. import modules.sd_unet
  21. modules.sd_unet.list_unets()
  22. ui_reorder_categories_builtin_items = [
  23. "inpaint",
  24. "sampler",
  25. "checkboxes",
  26. "hires_fix",
  27. "dimensions",
  28. "cfg",
  29. "seed",
  30. "batch",
  31. "override_settings",
  32. ]
  33. def ui_reorder_categories():
  34. from modules import scripts
  35. yield from ui_reorder_categories_builtin_items
  36. sections = {}
  37. for script in scripts.scripts_txt2img.scripts + scripts.scripts_img2img.scripts:
  38. if isinstance(script.section, str):
  39. sections[script.section] = 1
  40. yield from sections
  41. yield "scripts"