Views
No views yet
pip install torch==2.7.0 diffusers==0.33.1 transformers==4.51.3 accelerate==1.6.0 pillow==11.2.1 requests==2.32.31import torch
2import requests
3import PIL
4from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
5
6model_id = "peter-sushko/RealEdit"
7pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
8 model_id,
9 torch_dtype=torch.float16,
10 safety_checker=None
11)
12pipe.to("cuda")
13pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
14
15url = "https://raw.githubusercontent.com/AyanaBharadwaj/RealEdit/refs/heads/main/example_imgs/simba.jpg"
16def download_image(url):
17 image = PIL.Image.open(requests.get(url, stream=True).raw)
18 image = PIL.ImageOps.exif_transpose(image)
19 image = image.convert("RGB")
20 return image
21image = download_image(url)
22
23prompt = "give him a crown"
24result = pipe(prompt, image=image, num_inference_steps=50, image_guidance_scale=2).images[0]
25result.save("output.png")1git clone https://github.com/timothybrooks/instruct-pix2pix.git
2cd instruct-pix2pix
3mkdir checkpointscheckpoints directory:1cd checkpoints
2# wget https://huggingface.co/peter-sushko/RealEdit/resolve/main/realedit_model.ckpt1python edit_cli.py \
2 --input [YOUR_IMG_PATH] \
3 --output imgs/output.jpg \
4 --edit "YOUR EDIT INSTRUCTION" \
5 --ckpt checkpoints/realedit_model.ckpt@misc{sushko2025realeditredditeditslargescale,
title={REALEDIT: Reddit Edits As a Large-scale Empirical Dataset for Image Transformations},
author={Peter Sushko and Ayana Bharadwaj and Zhi Yang Lim and Vasily Ilin and Ben Caffee and Dongping Chen and Mohammadreza Salehi and Cheng-Yu Hsieh and Ranjay Krishna},
year={2025},
eprint={2502.03629},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2502.03629},
}