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

Method __init__

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

Source from the content-addressed store, hash-verified

516
517class ScribbleText2Image:
518 def __init__(self, device):
519 print(f"Initializing ScribbleText2Image to {device}")
520 self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32
521 self.controlnet = ControlNetModel.from_pretrained("fusing/stable-diffusion-v1-5-controlnet-scribble",
522 torch_dtype=self.torch_dtype)
523 self.pipe = StableDiffusionControlNetPipeline.from_pretrained(
524 "runwayml/stable-diffusion-v1-5", controlnet=self.controlnet, safety_checker=StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker'),
525 torch_dtype=self.torch_dtype
526 )
527 self.pipe.scheduler = UniPCMultistepScheduler.from_config(self.pipe.scheduler.config)
528 self.pipe.to(device)
529 self.seed = -1
530 self.a_prompt = 'best quality, extremely detailed'
531 self.n_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, ' \
532 'fewer digits, cropped, worst quality, low quality'
533
534 @prompts(name="Generate Image Condition On Sketch Image",
535 description="useful when you want to generate a new real image from both the user description and "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected