(self, args)
| 74 | pipeline_class = AutoPipelineForText2Image |
| 75 | |
| 76 | def __init__(self, args): |
| 77 | pipe = self.pipeline_class.from_pretrained(args.ckpt, torch_dtype=torch.float16) |
| 78 | pipe = pipe.to("cuda") |
| 79 | |
| 80 | if args.run_compile: |
| 81 | if not isinstance(pipe, WuerstchenCombinedPipeline): |
| 82 | pipe.unet.to(memory_format=torch.channels_last) |
| 83 | print("Run torch compile") |
| 84 | pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True) |
| 85 | |
| 86 | if hasattr(pipe, "movq") and getattr(pipe, "movq", None) is not None: |
| 87 | pipe.movq.to(memory_format=torch.channels_last) |
| 88 | pipe.movq = torch.compile(pipe.movq, mode="reduce-overhead", fullgraph=True) |
| 89 | else: |
| 90 | print("Run torch compile") |
| 91 | pipe.decoder = torch.compile(pipe.decoder, mode="reduce-overhead", fullgraph=True) |
| 92 | pipe.vqgan = torch.compile(pipe.vqgan, mode="reduce-overhead", fullgraph=True) |
| 93 | |
| 94 | pipe.set_progress_bar_config(disable=True) |
| 95 | self.pipe = pipe |
| 96 | |
| 97 | def run_inference(self, pipe, args): |
| 98 | _ = pipe( |
nothing calls this directly
no test coverage detected