Official PyTorch implementation of the paper: "FlowOpt: Fast Optimization Through Whole Flow Processes For Training-Free Editing"
git clone https://github.com/orronai/FlowOpt.git
cd FlowOptpython -m pip install -r requirements.txtReplace <MODEL> with either FLUX or SD3:
python FlowOpt.py --exp_yaml yaml_files/<MODEL>_inversion_exp.yamlReplace <MODEL> with either FLUX or SD3:
python FlowOpt.py --exp_yaml yaml_files/<MODEL>_editing_exp.yaml- 
Upload images to
datasetfolder. - 
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.
Seeyaml_files/edits.yamlfor example. - 
Create an experiment file containing the hyperparamaters needed for running FlowOpt, such as
T_steps,n_max,max_iterationsandeta. For an editing experiment, set the variableinversiontofalseand for inversion experiment set it totrue. This file also includes the path to theyaml_files/edits.yamlfile.
Seeyaml_files/<MODEL>_editing_exp.yamlforFLUX|SD3editing usage example, andyaml_files/<MODEL>_inversion_exp.yamlforFLUX|SD3inversion usage example.- The provided hyperparameters has been evaluated for images of dimension 
1024x1024. 
 - The provided hyperparameters has been evaluated for images of dimension 
 - 
Run FlowOpt:
 
python FlowOpt.py --exp_yaml <path_to_your_experiment_yaml>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.pyThis project is licensed under the MIT License.
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}
}

