Views
No views yet
pip install torch diffusers transformers pillow tqdm loguru numpyblack-forest-labs/FLUX.2-klein-4B1python infer.py \
2 --image input.jpg \
3 --edits "Replace the cat with a dog" "Replace the lamp with a vase" \
4 --masks mask_cat.png mask_lamp.png \
5 --output result.png--edits string and one --masks path per instance you want to edit.
Masks are binary images (white = instance region, black = background).1python infer.py \
2 --image input.jpg \
3 --edits "Replace the cat with a dog" \
4 --bboxes "0.1 0.2 0.5 0.8" \
5 --output result.png| Flag | Default | Description |
|---|---|---|
--image | (required) | Path to the input image |
--edits | (required) | Edit instruction per instance |
--masks | — | Binary mask image per instance (mutually exclusive with --bboxes) |
--bboxes | — | Normalized x1 y1 x2 y2 bbox per instance (mutually exclusive with --masks) |
--output | result.png | Output path |
--model | black-forest-labs/FLUX.2-klein-4B | HuggingFace model ID or local path |
--num_inference_steps | 4 | Number of denoising steps |
--kernel_size | 11 | Spatial kernel size for attention falloff |
--temperature | 3.0 | Steepness of spatial falloff |
--double_layers | 0,5 | Double-stream block range for attention binding |
--single_layers | 0,20 | Single-stream block range for attention binding |
--strict | flag | Stricter cross-instance isolation |
1python infer_flux2_mice.py \
2 --exp_name my_experiment \
3 --dataset_root ../mice_bench \
4 --num_inference_steps 4 \
5 --kernel_size 11 \
6 --temperature 3.0 \
7 --hard_image_attribute_binding_list_double 0,5 \
8 --hard_image_attribute_binding_list_single 0,20 \
9 --use_masksresults_micebench/mice_flux2_klein_<exp_name>/.1python infer_flux2_mice_sam3.py \
2 --exp_name my_experiment \
3 --dataset_root /path/to/mice_bench_sam3 \
4 --num_inference_steps 4 \
5 --kernel_size 11 \
6 --temperature 3.0 \
7 --use_masksresults_micebench_sam3/mice_flux2_sam3_<exp_name>/.benchmark/data/LoMOE-Bench/ relative to the repository root (path is hardcoded in lomoe_dataset.py).1python infer_flux2_lomoe.py \
2 --exp_name my_experiment \
3 --num_inference_steps 4 \
4 --kernel_size 11 \
5 --temperature 3.0 \
6 --hard_image_attribute_binding_list_double 0,5 \
7 --hard_image_attribute_binding_list_single 0,20 \
8 --use_masksresults/lomoe_flux2_klein_<exp_name>/.1python infer_flux2_lomoe_sam3.py \
2 --exp_name my_experiment \
3 --dataset_root /path/to/lomoe_bench_sam3 \
4 --num_inference_steps 4 \
5 --kernel_size 11 \
6 --temperature 3.0 \
7 --use_masksresults_sam3/lomoe_flux2_sam3_<exp_name>/.--dataset_root):mice_bench/
LoMOE.json
images/
masks/--dataset_root):<dataset_root>/
LoMOE_mobius.json # mask paths point to SAM3-generated masks
images/
masks/benchmark/data/LoMOE-Bench/):benchmark/data/LoMOE-Bench/
LoMOE.json
LoMOE_multi_turn_faithful.json
LoMOE_multi_turn_enhanced.json
utils/
mask_orig_prompts.txt
text_prompts.txt
images/
masks/