Welcome to this repository, a comprehensive collection of the four pivotal algorithms in the [specific domain] domain: P2P, MasaCtrl, PnP, and Pix2Pix-zero. This repository aims to provide an accessible, well-documented, and easy-to-understand resource for both beginners and experienced practitioners looking to explore and implement these algorithms.
Different editing methods demand specific environments, making it challenging to compare them due to varying requirements, such as diffusers versions. This often complicates the research process for those needing to install numerous environments. Our project standardizes these methods and is updated for the latest diffusers version (0.27), simplifying comparisons.
- The project integrates various inversion methods and interfaces for different stable diffusion versions (1.5, 2.1, XL), allowing researchers to easily switch between methods.
- It clarifies the logic behind editing methods by structuring the codes, helping researchers understand their similarities and differences.
- It Provides access to the PIE Benchmark, facilitating testing of editing methods on the same benchmark.
- Importantly, to ensure fairness in comparing different methods, specific engineering techniques unique to each method (such as using masks for local editing in p2p, or the use of Edit Directions in p2p-zero) are omitted. However, researchers can easily incorporate these elements.
pip install -r requirements.txt
We assume that you have already installed the pytorch.
You could download the weights of SD from huggingface, and modify the file sd_mapping.py
for each method.
We give three simple examples for using. All methods share the same structure.
cd p2p
python edit_real.py --sd_version 1.5 --device 0 --seed 0 --source_prompt "a gray horse in the field" --target_prompt "a whie horse in the field" --source_image ./test.jpg --inversion_type null-text
cd pnp
python edit_syn.py --xx xx..
First you should download the PIE-Bench dataset.
cd masactrl
python test.py
Our code is based on prompt-to-prompt, MasaCtrl, pix2pix-zero , Plug-and-Play, DirectionInversion thanks to all the contributors!