MCPcopy Create free account
hub / github.com/chenfei-wu/TaskMatrix / __init__

Method __init__

visual_chatgpt.py:460–474  ·  view source on GitHub ↗
(self, device)

Source from the content-addressed store, hash-verified

458
459class HedText2Image:
460 def __init__(self, device):
461 print(f"Initializing HedText2Image to {device}")
462 self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32
463 self.controlnet = ControlNetModel.from_pretrained("fusing/stable-diffusion-v1-5-controlnet-hed",
464 torch_dtype=self.torch_dtype)
465 self.pipe = StableDiffusionControlNetPipeline.from_pretrained(
466 "runwayml/stable-diffusion-v1-5", controlnet=self.controlnet, safety_checker=StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker'),
467 torch_dtype=self.torch_dtype
468 )
469 self.pipe.scheduler = UniPCMultistepScheduler.from_config(self.pipe.scheduler.config)
470 self.pipe.to(device)
471 self.seed = -1
472 self.a_prompt = 'best quality, extremely detailed'
473 self.n_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, ' \
474 'fewer digits, cropped, worst quality, low quality'
475
476 @prompts(name="Generate Image Condition On Soft Hed Boundary Image",
477 description="useful when you want to generate a new real image from both the user description "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected