(self, device)
| 245 | |
| 246 | class 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. " |
nothing calls this directly
no outgoing calls
no test coverage detected