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

Method __init__

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

Source from the content-addressed store, hash-verified

610
611class SegText2Image:
612 def __init__(self, device):
613 print(f"Initializing SegText2Image to {device}")
614 self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32
615 self.controlnet = ControlNetModel.from_pretrained("fusing/stable-diffusion-v1-5-controlnet-seg",
616 torch_dtype=self.torch_dtype)
617 self.pipe = StableDiffusionControlNetPipeline.from_pretrained(
618 "runwayml/stable-diffusion-v1-5", controlnet=self.controlnet, safety_checker=StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker'),
619 torch_dtype=self.torch_dtype)
620 self.pipe.scheduler = UniPCMultistepScheduler.from_config(self.pipe.scheduler.config)
621 self.pipe.to(device)
622 self.seed = -1
623 self.a_prompt = 'best quality, extremely detailed'
624 self.n_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit,' \
625 ' fewer digits, cropped, worst quality, low quality'
626
627 @prompts(name="Generate Image Condition On Segmentations",
628 description="useful when you want to generate a new real image from both the user description and segmentations. "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected