Downloads · 30 days
66
0% of all-time downloads
radames/instruct-pix2pix-img2img
instruct-pix2pix-img2img is a image-to-image model from radames. Use it when you need one image transformed into another. It is set up for diffusers. The card lists the license as mit.
GitHub: https://github.com/timothybrooks/instruct-pix2pix <img src='https://instruct-pix2pix.timothybrooks.com/teaser.jpg'/
Downloads · 30 days
66
0% of all-time downloads
All-time downloads
19.8K
Public
Parameters
860M
31.9 GB on disk
Likes
19
Public
Click a slice to open those files.
.safetensors13.2 GB · 50%
From the Hugging Face model README
GitHub: https://github.com/timothybrooks/instruct-pix2pix <img src='https://instruct-pix2pix.timothybrooks.com/teaser.jpg'/>
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 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]