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

Method __init__

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

Source from the content-addressed store, hash-verified

245
246class InstructPix2Pix:
247 def __init__(self, device):
248 print(f"Initializing InstructPix2Pix to {device}")
249 self.device = device
250 self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32
251
252 self.pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained("timbrooks/instruct-pix2pix",
253 safety_checker=StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker'),
254 torch_dtype=self.torch_dtype).to(device)
255 self.pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(self.pipe.scheduler.config)
256
257 @prompts(name="Instruct Image Using Text",
258 description="useful when you want to the style of the image to be like the text. "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected