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

Method __init__

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

Source from the content-addressed store, hash-verified

740
741class NormalText2Image:
742 def __init__(self, device):
743 print(f"Initializing NormalText2Image to {device}")
744 self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32
745 self.controlnet = ControlNetModel.from_pretrained(
746 "fusing/stable-diffusion-v1-5-controlnet-normal", torch_dtype=self.torch_dtype)
747 self.pipe = StableDiffusionControlNetPipeline.from_pretrained(
748 "runwayml/stable-diffusion-v1-5", controlnet=self.controlnet, safety_checker=StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker'),
749 torch_dtype=self.torch_dtype)
750 self.pipe.scheduler = UniPCMultistepScheduler.from_config(self.pipe.scheduler.config)
751 self.pipe.to(device)
752 self.seed = -1
753 self.a_prompt = 'best quality, extremely detailed'
754 self.n_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit,' \
755 ' fewer digits, cropped, worst quality, low quality'
756
757 @prompts(name="Generate Image Condition On Normal Map",
758 description="useful when you want to generate a new real image from both the user description and normal map. "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected