| | --- |
| | license: apache-2.0 |
| | language: |
| | - en |
| | library_name: diffusers |
| | pipeline_tag: image-to-image |
| | --- |
| | |
| | # Edit-R1 |
| |
|
| | <p align="center"> |
| | <a href="https://github.com/PKU-YuanGroup/Edit-R1"><b>Code</b></a> | <a href="https://github.com/PKU-YuanGroup/Edit-R1"><b>Dataset</b></a> |
| | </p> |
| | |
| |
|
| | # Performance |
| |
|
| | |Benchmark| FLUX.1-Kontext-dev | Edit-R1-FLUX.1-Kontext-dev | |
| | | ---- | ---- | ----| |
| | | GEdit-Bench | 6.00 | **6.74** | |
| | | ImgEdit | 3.71 | **4.02** | |
| |
|
| | # Usage |
| |
|
| | ```python |
| | import torch |
| | from diffusers import FluxKontextPipeline |
| | from diffusers.utils import load_image |
| | |
| | pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16) |
| | |
| | pipe.load_lora_weights( |
| | "chestnutlzj/Edit-R1-Qwen-Image-Edit-2509", |
| | adapter_name="lora", |
| | ) |
| | pipe.set_adapters(["lora"], adapter_weights=[1]) |
| | |
| | pipe.to("cuda") |
| | |
| | |
| | input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") |
| | |
| | image = pipe( |
| | image=input_image, |
| | prompt="Add a hat to the cat", |
| | guidance_scale=2.5 |
| | ).images[0] |
| | |
| | ``` |
| |
|
| | # Licence |
| |
|
| | FLUX.1-Kontext-dev falls under the [FLUX.1 [dev] Non-Commercial License](https://github.com/black-forest-labs/flux/blob/main/model_licenses/LICENSE-FLUX1-dev). |
| | |