Text-to-Image
PEFT
Safetensors
Diffusers
English
lora
flux
reinforcement-learning
face-diversity
multi-human
Instructions to use Qualcomm-AI-Research/disco with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Qualcomm-AI-Research/disco with PEFT:
Task type is invalid.
- Diffusers
How to use Qualcomm-AI-Research/disco with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", dtype=torch.bfloat16, device_map="cuda") pipe.load_lora_weights("Qualcomm-AI-Research/disco") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Inference
- Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +177 -0
- adapter_config.json +50 -0
- adapter_model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: black-forest-labs/FLUX.1-dev
|
| 3 |
+
library_name: peft
|
| 4 |
+
license: other
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- flux
|
| 8 |
+
- text-to-image
|
| 9 |
+
- diffusers
|
| 10 |
+
- peft
|
| 11 |
+
- reinforcement-learning
|
| 12 |
+
- face-diversity
|
| 13 |
+
- multi-human
|
| 14 |
+
language:
|
| 15 |
+
- en
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Resolving the Identity Crisis in Text-to-Image Generation
|
| 19 |
+
|
| 20 |
+
**DisCO** (Diversity Constraints via GRPO) is a LoRA adapter for [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) that dramatically improves facial diversity and identity distinctness in multi-human image generation.
|
| 21 |
+
|
| 22 |
+
[](https://arxiv.org/abs/2510.01399)
|
| 23 |
+
[](https://qualcomm-ai-research.github.io/disco/)
|
| 24 |
+
[](https://github.com/Qualcomm-AI-research/disco)
|
| 25 |
+
[](https://arxiv.org/abs/2510.01399)
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## Abstract
|
| 32 |
+
|
| 33 |
+
> Text-to-image models tend to generate duplicate faces, merge identities, or miscount people in multi-human scenes. DisCO addresses this by fine-tuning flow-matching models via reinforcement learning to optimize facial diversity both within individual images and across sample batches. The method employs a composite reward function that addresses facial similarity penalties, deters identity repetition, ensures accurate person counting, and preserves image quality. Testing on our evaluation benchmark demonstrates superior performance, achieving approximately 98.6% unique-face accuracy while also outperforming both open-source and proprietary competitors. Notably, the approach requires no external training data, making it a scalable solution for generating images containing multiple distinct individuals.
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## Model Details
|
| 40 |
+
|
| 41 |
+
| Field | Value |
|
| 42 |
+
|---|---|
|
| 43 |
+
| Base model | `black-forest-labs/FLUX.1-dev` |
|
| 44 |
+
| Adapter type | LoRA (PEFT) |
|
| 45 |
+
| LoRA rank (r) | 64 |
|
| 46 |
+
| LoRA alpha | 128 |
|
| 47 |
+
| Dropout | 0.0 |
|
| 48 |
+
| Weight init | Gaussian |
|
| 49 |
+
| Target modules | All attention projections + feed-forward layers (12 modules) |
|
| 50 |
+
| PEFT version | 0.17.0 |
|
| 51 |
+
|
| 52 |
+
**Target modules:** `attn.to_q`, `attn.to_k`, `attn.to_v`, `attn.to_out.0`, `attn.to_add_out`, `attn.add_q_proj`, `attn.add_k_proj`, `attn.add_v_proj`, `ff.net.0.proj`, `ff.net.2`, `ff_context.net.0.proj`, `ff_context.net.2`
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## Notes
|
| 57 |
+
|
| 58 |
+
> **Disclaimer:** The model weights released here are not identical to the model reported in the paper. They are provided for research and demonstration purposes only. Performance may vary from the results reported in the paper.
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## Usage
|
| 63 |
+
|
| 64 |
+
### Option 1: DisCO inference repo (recommended)
|
| 65 |
+
|
| 66 |
+
Clone the repo — weights are pulled automatically from HuggingFace on first run:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
git clone https://github.com/Qualcomm-AI-research/disco.git
|
| 70 |
+
cd disco
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Run inference (no manual weight download needed):
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
# Side-by-side base vs DisCO
|
| 77 |
+
python inference.py --prompt "A stunning close-up of Six people on a campus walkway, clear faces visible, fine detail, lifelike rendering, diversity in ethnicity." --compare
|
| 78 |
+
|
| 79 |
+
# DisCO only
|
| 80 |
+
python inference.py --prompt "A stunning close-up of Six people on a campus walkway, clear faces visible, fine detail, lifelike rendering, diversity in ethnicity."
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
If you prefer to use locally downloaded weights (e.g. from [GitHub Releases](https://github.com/Qualcomm-AI-research/disco/releases)), place them at `loras/disco/adapter_model.safetensors` — the code will use the local copy automatically.
|
| 84 |
+
|
| 85 |
+
Or launch the Gradio demo:
|
| 86 |
+
|
| 87 |
+
```bash
|
| 88 |
+
python app.py
|
| 89 |
+
# open http://localhost:7864
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
### Option 2: Directly with PEFT + Diffusers
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
import torch
|
| 96 |
+
from diffusers import FluxPipeline
|
| 97 |
+
from peft import PeftModel
|
| 98 |
+
|
| 99 |
+
pipe = FluxPipeline.from_pretrained(
|
| 100 |
+
"black-forest-labs/FLUX.1-dev",
|
| 101 |
+
torch_dtype=torch.bfloat16,
|
| 102 |
+
).to("cuda")
|
| 103 |
+
|
| 104 |
+
pipe.transformer = PeftModel.from_pretrained(
|
| 105 |
+
pipe.transformer,
|
| 106 |
+
"Qualcomm-AI-Research/disco",
|
| 107 |
+
)
|
| 108 |
+
pipe.transformer = pipe.transformer.merge_and_unload()
|
| 109 |
+
|
| 110 |
+
image = pipe(
|
| 111 |
+
"Six people on a campus walkway, diverse faces, clear faces visible, "
|
| 112 |
+
"fine detail, lifelike rendering, diversity in ethnicity.",
|
| 113 |
+
height=1024,
|
| 114 |
+
width=1024,
|
| 115 |
+
num_inference_steps=28,
|
| 116 |
+
guidance_scale=3.5,
|
| 117 |
+
generator=torch.Generator("cpu").manual_seed(42),
|
| 118 |
+
).images[0]
|
| 119 |
+
|
| 120 |
+
image.save("disco_output.png")
|
| 121 |
+
```
|
| 122 |
+
|
| 123 |
+
### Recommended prompts
|
| 124 |
+
|
| 125 |
+
```
|
| 126 |
+
Two people on a shallow beach, diverse faces, clear faces visible, realistic lighting
|
| 127 |
+
Four people in a city plaza, midday, diverse faces, clear faces visible, high fidelity
|
| 128 |
+
Six people on a campus walkway, diverse faces, clear faces visible, lifelike rendering
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
---
|
| 132 |
+
|
| 133 |
+
## Hardware Requirements
|
| 134 |
+
|
| 135 |
+
- **GPU:** NVIDIA A100 40 GB (or equivalent, ≥ 40 GB VRAM)
|
| 136 |
+
- **CUDA:** 12.4
|
| 137 |
+
- **Python:** 3.11
|
| 138 |
+
- **PyTorch:** 2.6.0
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
## Training Details
|
| 143 |
+
|
| 144 |
+
DisCO is trained with Flow-GRPO, a flow-matching adaptation of Group Relative Policy Optimization (GRPO):
|
| 145 |
+
|
| 146 |
+
- **Base model:** FLUX.1-dev (flow-matching transformer)
|
| 147 |
+
- **Training algorithm:** Flow-GRPO (RL via composite reward signal)
|
| 148 |
+
- **Reward components:**
|
| 149 |
+
- Face similarity penalty (ArcFace embeddings, intra-image)
|
| 150 |
+
- Batch-level identity diversity (cross-sample)
|
| 151 |
+
- Person count accuracy (headcount matching prompt)
|
| 152 |
+
- HPS v3 image quality score
|
| 153 |
+
- **No external training data** — rewards are computed fully at inference time
|
| 154 |
+
- **Training regime:** bf16 mixed precision, 7 GPUs
|
| 155 |
+
|
| 156 |
+
---
|
| 157 |
+
|
| 158 |
+
## Citation
|
| 159 |
+
|
| 160 |
+
```bibtex
|
| 161 |
+
@InProceedings{Borse_2026_CVPR,
|
| 162 |
+
author = {Borse, Shubhankar and Farhadzadeh, Farzad and Hayat, Munawar and Porikli, Fatih},
|
| 163 |
+
title = {Resolving the Identity Crisis in Text-to-Image Generation},
|
| 164 |
+
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
|
| 165 |
+
month = {June},
|
| 166 |
+
year = {2026},
|
| 167 |
+
pages = {36703--36712},
|
| 168 |
+
}
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
## License
|
| 174 |
+
|
| 175 |
+
These weights are derived from [FLUX.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) and are subject to the [FLUX.1 Non-Commercial License](https://github.com/Qualcomm-AI-research/disco/blob/main/LICENSE-FLUX1-dev.txt). Any use of these weights must comply with that license.
|
| 176 |
+
|
| 177 |
+
Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
|
adapter_config.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"alpha_pattern": {},
|
| 3 |
+
"auto_mapping": {
|
| 4 |
+
"base_model_class": "FluxTransformer2DModel",
|
| 5 |
+
"parent_library": "diffusers.models.transformers.transformer_flux"
|
| 6 |
+
},
|
| 7 |
+
"base_model_name_or_path": "black-forest-labs/FLUX.1-dev",
|
| 8 |
+
"bias": "none",
|
| 9 |
+
"corda_config": null,
|
| 10 |
+
"eva_config": null,
|
| 11 |
+
"exclude_modules": null,
|
| 12 |
+
"fan_in_fan_out": false,
|
| 13 |
+
"inference_mode": true,
|
| 14 |
+
"init_lora_weights": "gaussian",
|
| 15 |
+
"layer_replication": null,
|
| 16 |
+
"layers_pattern": null,
|
| 17 |
+
"layers_to_transform": null,
|
| 18 |
+
"loftq_config": {},
|
| 19 |
+
"lora_alpha": 128,
|
| 20 |
+
"lora_bias": false,
|
| 21 |
+
"lora_dropout": 0.0,
|
| 22 |
+
"megatron_config": null,
|
| 23 |
+
"megatron_core": "megatron.core",
|
| 24 |
+
"modules_to_save": null,
|
| 25 |
+
"peft_type": "LORA",
|
| 26 |
+
"qalora_group_size": 16,
|
| 27 |
+
"r": 64,
|
| 28 |
+
"rank_pattern": {},
|
| 29 |
+
"revision": null,
|
| 30 |
+
"target_modules": [
|
| 31 |
+
"attn.to_v",
|
| 32 |
+
"attn.add_q_proj",
|
| 33 |
+
"ff.net.2",
|
| 34 |
+
"ff_context.net.2",
|
| 35 |
+
"attn.to_k",
|
| 36 |
+
"attn.add_k_proj",
|
| 37 |
+
"attn.to_q",
|
| 38 |
+
"ff_context.net.0.proj",
|
| 39 |
+
"attn.to_add_out",
|
| 40 |
+
"ff.net.0.proj",
|
| 41 |
+
"attn.to_out.0",
|
| 42 |
+
"attn.add_v_proj"
|
| 43 |
+
],
|
| 44 |
+
"target_parameters": null,
|
| 45 |
+
"task_type": null,
|
| 46 |
+
"trainable_token_indices": null,
|
| 47 |
+
"use_dora": false,
|
| 48 |
+
"use_qalora": false,
|
| 49 |
+
"use_rslora": false
|
| 50 |
+
}
|
adapter_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1855410eac4ccf34dc8345e2f79213a119d107a31ab66948cc56cd929d96b8af
|
| 3 |
+
size 358709456
|