Image-to-Image
Diffusers
Safetensors
flux
semantic-segmentation
instance-segmentation
referring-segmentation
depth-estimation
surface-normal-estimation
image-editing
text-to-image
Instructions to use FunAILab/Open-Vision-Banana with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use FunAILab/Open-Vision-Banana with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("FunAILab/Open-Vision-Banana", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Model card: task collage, editing and generation prompts, LoRA adapters
Browse files- .gitattributes +2 -0
- README.md +20 -16
- assets/icons/depth.png +0 -0
- assets/icons/generation.png +0 -0
- assets/icons/imgedit.png +0 -0
- assets/icons/instanceseg.png +0 -0
- assets/icons/normals.png +0 -0
- assets/icons/refseg.png +0 -0
- assets/icons/semseg.png +0 -0
- assets/ovb_collage.png +3 -0
- assets/{ovb_collage.jpg → ovb_overview.jpg} +2 -2
.gitattributes
CHANGED
|
@@ -34,3 +34,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
assets/ovb_collage.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
assets/ovb_collage.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/ovb_collage.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
assets/ovb_overview.jpg filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -24,12 +24,21 @@ tags:
|
|
| 24 |
</p>
|
| 25 |
|
| 26 |
<p align="center">
|
| 27 |
-
<img src="assets/ovb_collage.
|
| 28 |
</p>
|
| 29 |
|
| 30 |
Outputs of the zero-shot 9B model on an in-the-wild photo, with the summarised prompt below each output.
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
Install PyTorch with CUDA support first, then:
|
| 35 |
|
|
@@ -37,7 +46,7 @@ Install PyTorch with CUDA support first, then:
|
|
| 37 |
pip install "diffusers>=0.37.0" transformers accelerate safetensors pillow
|
| 38 |
```
|
| 39 |
|
| 40 |
-
The fine-tuned transformer is swapped into the [FLUX.2 [klein] base 9B](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B) pipeline. One model handles every task and the prompt selects it. This example runs semantic segmentation:
|
| 41 |
|
| 42 |
```python
|
| 43 |
import torch
|
|
@@ -79,11 +88,11 @@ output = pipe(
|
|
| 79 |
output.resize(image.size, Image.NEAREST).save("output.png")
|
| 80 |
```
|
| 81 |
|
| 82 |
-
### Quickstart prompts for the other tasks
|
| 83 |
|
| 84 |
Replace `prompt` above with one of these.
|
| 85 |
|
| 86 |
-
**Referring segmentation**
|
| 87 |
|
| 88 |
```python
|
| 89 |
prompt = (
|
|
@@ -93,7 +102,7 @@ prompt = (
|
|
| 93 |
)
|
| 94 |
```
|
| 95 |
|
| 96 |
-
**Instance segmentation**
|
| 97 |
|
| 98 |
```python
|
| 99 |
prompt = (
|
|
@@ -111,7 +120,7 @@ prompt = (
|
|
| 111 |
)
|
| 112 |
```
|
| 113 |
|
| 114 |
-
**Depth estimation**
|
| 115 |
|
| 116 |
```python
|
| 117 |
prompt = (
|
|
@@ -124,7 +133,7 @@ prompt = (
|
|
| 124 |
)
|
| 125 |
```
|
| 126 |
|
| 127 |
-
**Surface normal estimation**
|
| 128 |
|
| 129 |
```python
|
| 130 |
prompt = (
|
|
@@ -135,7 +144,7 @@ prompt = (
|
|
| 135 |
)
|
| 136 |
```
|
| 137 |
|
| 138 |
-
**Image editing**
|
| 139 |
|
| 140 |
```python
|
| 141 |
prompt = (
|
|
@@ -143,7 +152,7 @@ prompt = (
|
|
| 143 |
)
|
| 144 |
```
|
| 145 |
|
| 146 |
-
**Text-to-image generation**
|
| 147 |
|
| 148 |
Call the pipeline without `image` and give it a size:
|
| 149 |
|
|
@@ -168,12 +177,7 @@ These are quickstart prompts, one per task. The model was trained on many phrasi
|
|
| 168 |
- **Image editing:** keep the `[TASK: IMAGE_EDITING]` tag and write the edit as a plain instruction.
|
| 169 |
- **Generation:** a plain description without a tag and without an input image.
|
| 170 |
|
| 171 |
-
##
|
| 172 |
-
|
| 173 |
-
- `final_models/{4B,9B}/{zeroshot,nonzeroshot}/checkpoint-*/transformer`: fine-tuned transformers for both base sizes, loaded as in the quickstart with the matching base pipeline (`FLUX.2-klein-base-4B` or `-9B`).
|
| 174 |
-
- `ablation_models/`: one checkpoint per ablation setting from the paper.
|
| 175 |
-
|
| 176 |
-
## LoRA adapters
|
| 177 |
|
| 178 |
`ablation_models/f2kbase4b_lora_zeroshot_ablations/` contains the LoRA adapters of the paper's LoRA table, trained on FLUX.2 [klein] base 4B over the zero-shot data: ranks 64, 128 and 256 at 25K, 37.5K, 50K, 75K and 100K steps, and ranks 512 and 1024 at 37.5K steps. `manifest.md` lists every adapter. Each adapter loads into the unmodified 4B base pipeline:
|
| 179 |
|
|
|
|
| 24 |
</p>
|
| 25 |
|
| 26 |
<p align="center">
|
| 27 |
+
<img src="assets/ovb_collage.png" width="100%" alt="Zero-shot OVB outputs on an in-the-wild photo: semantic, instance and referring segmentation, depth, surface normals, image editing and text-to-image generation, with the prompt below each output">
|
| 28 |
</p>
|
| 29 |
|
| 30 |
Outputs of the zero-shot 9B model on an in-the-wild photo, with the summarised prompt below each output.
|
| 31 |
|
| 32 |
+
<p align="center">
|
| 33 |
+
<img src="assets/ovb_overview.jpg" width="100%" alt="Overview of the Open Vision Banana recipe and analysis framework">
|
| 34 |
+
</p>
|
| 35 |
+
|
| 36 |
+
## 📦 Checkpoints
|
| 37 |
+
|
| 38 |
+
- `final_models/{4B,9B}/{zeroshot,nonzeroshot}/`: the fine-tuned transformers for both base sizes. The zero-shot models are trained without the training splits of the evaluation benchmarks, and the non-zero-shot models include them. Each folder holds the intermediate `checkpoint-<step>` exports and the weight-averaged checkpoint used in the paper, each as a `transformer/` subfolder.
|
| 39 |
+
- `ablation_models/`: one checkpoint per ablation setting of the paper, and the LoRA adapters described at the bottom of this page.
|
| 40 |
+
|
| 41 |
+
## 🚀 Quickstart
|
| 42 |
|
| 43 |
Install PyTorch with CUDA support first, then:
|
| 44 |
|
|
|
|
| 46 |
pip install "diffusers>=0.37.0" transformers accelerate safetensors pillow
|
| 47 |
```
|
| 48 |
|
| 49 |
+
The fine-tuned transformer is swapped into the [FLUX.2 [klein] base 9B](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9B) pipeline. One model handles every task and the prompt selects it. This example runs <img src="assets/icons/semseg.png" width="26" alt=""> semantic segmentation:
|
| 50 |
|
| 51 |
```python
|
| 52 |
import torch
|
|
|
|
| 88 |
output.resize(image.size, Image.NEAREST).save("output.png")
|
| 89 |
```
|
| 90 |
|
| 91 |
+
### 🎯 Quickstart prompts for the other tasks
|
| 92 |
|
| 93 |
Replace `prompt` above with one of these.
|
| 94 |
|
| 95 |
+
<img src="assets/icons/refseg.png" width="26" alt=""> **Referring segmentation**
|
| 96 |
|
| 97 |
```python
|
| 98 |
prompt = (
|
|
|
|
| 102 |
)
|
| 103 |
```
|
| 104 |
|
| 105 |
+
<img src="assets/icons/instanceseg.png" width="26" alt=""> **Instance segmentation**
|
| 106 |
|
| 107 |
```python
|
| 108 |
prompt = (
|
|
|
|
| 120 |
)
|
| 121 |
```
|
| 122 |
|
| 123 |
+
<img src="assets/icons/depth.png" width="26" alt=""> **Depth estimation**
|
| 124 |
|
| 125 |
```python
|
| 126 |
prompt = (
|
|
|
|
| 133 |
)
|
| 134 |
```
|
| 135 |
|
| 136 |
+
<img src="assets/icons/normals.png" width="26" alt=""> **Surface normal estimation**
|
| 137 |
|
| 138 |
```python
|
| 139 |
prompt = (
|
|
|
|
| 144 |
)
|
| 145 |
```
|
| 146 |
|
| 147 |
+
<img src="assets/icons/imgedit.png" width="26" alt=""> **Image editing**
|
| 148 |
|
| 149 |
```python
|
| 150 |
prompt = (
|
|
|
|
| 152 |
)
|
| 153 |
```
|
| 154 |
|
| 155 |
+
<img src="assets/icons/generation.png" width="26" alt=""> **Text-to-image generation**
|
| 156 |
|
| 157 |
Call the pipeline without `image` and give it a size:
|
| 158 |
|
|
|
|
| 177 |
- **Image editing:** keep the `[TASK: IMAGE_EDITING]` tag and write the edit as a plain instruction.
|
| 178 |
- **Generation:** a plain description without a tag and without an input image.
|
| 179 |
|
| 180 |
+
## 🧩 LoRA adapters
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
`ablation_models/f2kbase4b_lora_zeroshot_ablations/` contains the LoRA adapters of the paper's LoRA table, trained on FLUX.2 [klein] base 4B over the zero-shot data: ranks 64, 128 and 256 at 25K, 37.5K, 50K, 75K and 100K steps, and ranks 512 and 1024 at 37.5K steps. `manifest.md` lists every adapter. Each adapter loads into the unmodified 4B base pipeline:
|
| 183 |
|
assets/icons/depth.png
ADDED
|
|
assets/icons/generation.png
ADDED
|
|
assets/icons/imgedit.png
ADDED
|
|
assets/icons/instanceseg.png
ADDED
|
|
assets/icons/normals.png
ADDED
|
|
assets/icons/refseg.png
ADDED
|
|
assets/icons/semseg.png
ADDED
|
|
assets/ovb_collage.png
ADDED
|
Git LFS Details
|
assets/{ovb_collage.jpg → ovb_overview.jpg}
RENAMED
|
File without changes
|