image-to-imagediffusersmit

timbrooks/instruct-pix2pix

huggingface.co/timbrooks/instruct-pix2pix

1,178Likes
34,028Downloads
2023-07-05Updated
diffuserssafetensorsimage-to-imagelicense:mitdiffusers:StableDiffusionInstructPix2PixPipelineregion:us

Model card

InstructPix2Pix: Learning to Follow Image Editing Instructions

GitHub: https://github.com/timothybrooks/instruct-pix2pix

Example

To use InstructPix2Pix, install diffusers using main for now. The pipeline will be available in the next release

``bash pip install diffusers accelerate safetensors transformers ``

```python import PIL import requests import torch from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler

model_id = "timbrooks/instruct-pix2pix" pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16, safety_checker=None) pipe.to("cuda") pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)

url = "https://raw.githubusercontent.com/timothybrooks/instruct-pix2pix/main/imgs/example.jpg" def download_image(url): image = PIL.Image.open(requests.get(url, stream=True).raw) image = PIL.ImageOps.exif_transpose(image) image = image.convert("RGB") return image image = download_image(url)

prompt = "turn him into cyborg" images = pipe(prompt, image=image, num_inference_steps=10, image_guidance_scale=1).images images[0] ```

Mirrored from the Hugging Face Hub and served from the Conceptio Open Knowledge Archive. Read the original card at https://huggingface.co/timbrooks/instruct-pix2pix.