instruct-pix2pix#
README(From Huggingface)#
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
pip install diffusers accelerate safetensors transformers
import PIL
import requests
import paddle
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
model_id = "timbrooks/instruct-pix2pix"
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, dtype=paddle.float16, safety_checker=None)
pipe
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]
Model Files#
README.md (1.3 KB)
model_index.json (683.0 B)
safety_checker/config.json (731.0 B)
safety_checker/model_state.pdparams (1.1 GB)
scheduler/scheduler_config.json (600.0 B)
text_encoder/config.json (691.0 B)
text_encoder/model_state.pdparams (469.5 MB)
tokenizer/merges.txt (512.3 KB)
tokenizer/special_tokens_map.json (389.0 B)
tokenizer/tokenizer_config.json (842.0 B)
tokenizer/vocab.json (1.0 MB)
unet/config.json (1.4 KB)
unet/model_state.pdparams (3.2 GB)
vae/config.json (829.0 B)
vae/model_state.pdparams (319.1 MB)