(self, args)
| 274 | image = load_image(url).convert("RGB") |
| 275 | |
| 276 | def __init__(self, args): |
| 277 | aux_network = self.aux_network_class.from_pretrained(args.ckpt, torch_dtype=torch.float16) |
| 278 | pipe = self.pipeline_class.from_pretrained(self.root_ckpt, controlnet=aux_network, torch_dtype=torch.float16) |
| 279 | pipe = pipe.to("cuda") |
| 280 | |
| 281 | pipe.set_progress_bar_config(disable=True) |
| 282 | self.pipe = pipe |
| 283 | |
| 284 | if args.run_compile: |
| 285 | pipe.unet.to(memory_format=torch.channels_last) |
| 286 | pipe.controlnet.to(memory_format=torch.channels_last) |
| 287 | |
| 288 | print("Run torch compile") |
| 289 | pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True) |
| 290 | pipe.controlnet = torch.compile(pipe.controlnet, mode="reduce-overhead", fullgraph=True) |
| 291 | |
| 292 | self.image = self.image.resize(RESOLUTION_MAPPING[args.ckpt]) |
| 293 | |
| 294 | def run_inference(self, pipe, args): |
| 295 | _ = pipe( |
nothing calls this directly
no test coverage detected