MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / __init__

Method __init__

benchmarks/base_classes.py:276–292  ·  view source on GitHub ↗
(self, args)

Source from the content-addressed store, hash-verified

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(

Callers

nothing calls this directly

Calls 4

from_pretrainedMethod · 0.45
toMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected