(self, is_img2img)
| 20 | return scripts.AlwaysVisible |
| 21 | |
| 22 | def ui(self, is_img2img): |
| 23 | choices = ([""] if is_img2img else ["", "[STOP]"]) + sd_models.checkpoint_tiles() |
| 24 | |
| 25 | with InputAccordion(False, label="Refiner", elem_id=self.elem_id("enable")) as enable_refiner: |
| 26 | with gr.Row(): |
| 27 | refiner_checkpoint = gr.Dropdown(show_label=False, label="Refiner", info="(use model of same architecture)", elem_id=self.elem_id("checkpoint"), choices=choices, value="", tooltip="switch to another model in the middle of generation") |
| 28 | |
| 29 | refiner_switch_at = gr.Slider(value=0.8, label="Switch at", minimum=0.01, maximum=1.0, step=0.01, elem_id=self.elem_id("switch_at"), tooltip="fraction of sampling steps when the switch to refiner model should happen; 1=never, 0.5=switch in the middle of generation") |
| 30 | |
| 31 | self.infotext_fields = [ |
| 32 | PasteField(enable_refiner, lambda d: "Refiner" in d), |
| 33 | PasteField(refiner_checkpoint, "Refiner", api="refiner_checkpoint"), |
| 34 | PasteField(refiner_switch_at, "Refiner switch at", api="refiner_switch_at"), |
| 35 | ] |
| 36 | |
| 37 | return enable_refiner, refiner_checkpoint, refiner_switch_at |
| 38 | |
| 39 | def setup(self, p, enable_refiner, refiner_checkpoint, refiner_switch_at): |
| 40 | # the actual implementation is in sd_samplers_common.py, apply_refiner |
| 41 | if not enable_refiner or refiner_checkpoint in (None, ""): |
| 42 | p.refiner_checkpoint = None |
| 43 | p.refiner_switch_at = None |
| 44 | else: |
| 45 | p.refiner_checkpoint = refiner_checkpoint |
| 46 | p.refiner_switch_at = refiner_switch_at |
nothing calls this directly
no test coverage detected