Skip to content

Official implementation of the paper: "FlowOpt: Fast Optimization Through Whole Flow Processes For Training-Free Editing"

License

Notifications You must be signed in to change notification settings

orronai/FlowOpt

Repository files navigation

Zero-Shot Image Editing Python 3.8.10 torch Matplotlib

FlowOpt

Project | Arxiv | Demo

Official PyTorch implementation of the paper: "FlowOpt: Fast Optimization Through Whole Flow Processes For Training-Free Editing"

Teaser

Installation

1. Clone the repo

git clone https://github.com/orronai/FlowOpt.git
cd FlowOpt

2. Install the required environment

python -m pip install -r requirements.txt

Usage Example

A. Inversion

Replace <MODEL> with either FLUX or SD3:

python FlowOpt.py --exp_yaml yaml_files/<MODEL>_inversion_exp.yaml

B. Editing

Replace <MODEL> with either FLUX or SD3:

python FlowOpt.py --exp_yaml yaml_files/<MODEL>_editing_exp.yaml

Usage — Your Own Examples

  • Upload images to dataset folder.

  • Create an edits file that specifies: (a) a path to the input image, (b) a source prompt, (c) target prompts, and (d) target codes. The target codes summarize the changes between the source and target prompts and will appear in the output filename.
    See yaml_files/edits.yaml for example.

  • Create an experiment file containing the hyperparamaters needed for running FlowOpt, such as T_steps, n_max, max_iterations and eta. For an editing experiment, set the variable inversion to false and for inversion experiment set it to true. This file also includes the path to the yaml_files/edits.yaml file.
    See yaml_files/<MODEL>_editing_exp.yaml for FLUX|SD3 editing usage example, and yaml_files/<MODEL>_inversion_exp.yaml for FLUX|SD3 inversion usage example.

    • The provided hyperparameters has been evaluated for images of dimension 1024x1024.
  • Run FlowOpt:

python FlowOpt.py --exp_yaml <path_to_your_experiment_yaml>

Gradio GUI

For easy image editing you can also use gradio GUI.

  • Install gradio library:
pip install gradio
  • Run FlowOpt gradio (examples are included in the demo):
python FlowOpt_gradio.py

Gradio

License

This project is licensed under the MIT License.

Citation

If you use this code for your research, please cite our paper:

@article{ronai2025flowopt,
	title={FlowOpt: Fast Optimization Through Whole Flow Processes for Training-Free Editing},
	author={Ronai, Or and Kulikov, Vladimir, and Michaeli, Tomer},
	journal={arXiv preprint arXiv:2510.22010},
	year={2025}
}

About

Official implementation of the paper: "FlowOpt: Fast Optimization Through Whole Flow Processes For Training-Free Editing"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages