--- license: creativeml-openrail-m datasets: - osunlp/MagicBrush --- # InstructPix2Pix checkpoint fine-tuned on [MagicBrush](https://osu-nlp-group.github.io/MagicBrush/). ## 1. Env Setup To use the InstructPix2Pix checkpoint fine-tuned on MagicBrush, set up env with following command: ```shell git clone https://github.com/timothybrooks/instruct-pix2pix.git cd instruct-pix2pix mkdir checkpoints ``` Download this checkpoint into `checkpoints` folder via ```shell cd checkpoints # recent best checkpoint: wget https://huggingface.co/osunlp/InstructPix2Pix-MagicBrush/resolve/main/MagicBrush-epoch-52-step-4999.ckpt # checkpoint in the paper # wget https://huggingface.co/osunlp/InstructPix2Pix-MagicBrush/resolve/main/MagicBrush-epoch-000168.ckpt ``` Then go back to the root folder and set up the running env following the [InstructPix2Pix](https://github.com/timothybrooks/instruct-pix2pix) guidelines. ## 2. Launch ### Edit a single image: ```python python edit_cli.py --input [YOUR_IMG_PATH] --output imgs/output.jpg --edit "EDIT INSTRUCTION" --ckpt checkpoints/MagicBrush-epoch-52-step-4999.ckpt # Our model is fine-tuned for fine-grained real image editing. Therefore, it may not perform well on style transfer or other editings on large region. # e.g. python edit_cli.py --input imgs/example.jpg --output imgs/output.jpg --edit "let him wear a pair of sun glasses" --ckpt checkpoints/MagicBrush-epoch-52-step-4999.ckpt ```