9
stars
5
commits
8
repos using this model
5
linked in READMEs
Mar 5, 2025
updated
We propose EliGen, a novel approach that leverages fine-grained entity-level information to enable precise and controllable text-to-image generation. EliGen excels in tasks such as entity-level controlled image generation and image inpainting, while its applicability is not limited to these areas. Additionally, it can be seamlessly integrated with existing community models, such as the IP-Adpater and In-Cotext LoRA.

We introduce a regional attention mechanism within the DiT framework to effectively process the conditions of each entity. This mechanism enables the local prompt associated with each entity to semantically influence specific regions through regional attention. To further enhance the layout control capabilities of EliGen, we meticulously contribute an entity-annotated dataset and fine-tune the model using the LoRA framework.
Regional Attention: Regional attention is shown in above figure, which can be easily applied to other text-to-image models. Its core principle involves transforming the positional information of each entity into an attention mask, ensuring that the mechanism only affects the designated regions.
Dataset with Entity Annotation: To construct a dedicated entity control dataset, we start by randomly selecting captions from DiffusionDB and generating the corresponding source image using Flux. Next, we employ Qwen2-VL 72B, recognized for its advanced grounding capabilities among MLLMs, to randomly identify entities within the image. These entities are annotated with local prompts and bounding boxes for precise localization, forming the foundation of our dataset for further training.
Training: We utilize LoRA (Low-Rank Adaptation) and DeepSpeed to fine-tune regional attention mechanisms using a curated dataset, enabling our EliGen model to achieve effective entity-level control.
This model was trained using DiffSynth-Studio. We recommend using DiffSynth-Studio for generation.
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -e .
models/lora/entity_control and run the following command to try interactive UI:
python apps/gradio/entity_level_control.py
example_1-6 for generation prompts.| Entity Conditions | Generated Image |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
example_7 for the prompts.| Entity Conditions | Generated Image |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
Demonstration of the inpainting mode of EliGen, see entity_inpaint.py for generation prompts.
| Inpainting Input | Inpainting Output |
|---|---|
![]() | ![]() |
![]() | ![]() |
Demonstration of the styled entity control results with EliGen and IP-Adapter, see entity_control_ipadapter.py for generation prompts.
| Style Reference | Entity Control Variance 1 | Entity Control Variance 2 | Entity Control Variance 3 |
|---|---|---|---|
![]() | ![]() | ![]() | ![]() |
We also provide a demo of the styled entity control results with EliGen and specific styled lora, see ./styled_entity_control.py for details. Here is the visualization of EliGen with Lego dreambooth lora.
![]() | ![]() | ![]() | ![]() |
|---|---|---|---|
![]() | ![]() | ![]() | ![]() |
Demonstration of the entity transfer results with EliGen and In-Context LoRA, see entity_transfer.py for generation prompts.
| Entity to Transfer | Transfer Target Image | Transfer Example 1 | Transfer Example 2 |
|---|---|---|---|
![]() | ![]() | ![]() | ![]() |
5 commits
9
stars
5
commits
8
repos using this model
5
linked in READMEs
Mar 5, 2025
updated
We propose EliGen, a novel approach that leverages fine-grained entity-level information to enable precise and controllable text-to-image generation. EliGen excels in tasks such as entity-level controlled image generation and image inpainting, while its applicability is not limited to these areas. Additionally, it can be seamlessly integrated with existing community models, such as the IP-Adpater and In-Cotext LoRA.

We introduce a regional attention mechanism within the DiT framework to effectively process the conditions of each entity. This mechanism enables the local prompt associated with each entity to semantically influence specific regions through regional attention. To further enhance the layout control capabilities of EliGen, we meticulously contribute an entity-annotated dataset and fine-tune the model using the LoRA framework.
Regional Attention: Regional attention is shown in above figure, which can be easily applied to other text-to-image models. Its core principle involves transforming the positional information of each entity into an attention mask, ensuring that the mechanism only affects the designated regions.
Dataset with Entity Annotation: To construct a dedicated entity control dataset, we start by randomly selecting captions from DiffusionDB and generating the corresponding source image using Flux. Next, we employ Qwen2-VL 72B, recognized for its advanced grounding capabilities among MLLMs, to randomly identify entities within the image. These entities are annotated with local prompts and bounding boxes for precise localization, forming the foundation of our dataset for further training.
Training: We utilize LoRA (Low-Rank Adaptation) and DeepSpeed to fine-tune regional attention mechanisms using a curated dataset, enabling our EliGen model to achieve effective entity-level control.
This model was trained using DiffSynth-Studio. We recommend using DiffSynth-Studio for generation.
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -e .
models/lora/entity_control and run the following command to try interactive UI:
python apps/gradio/entity_level_control.py
example_1-6 for generation prompts.| Entity Conditions | Generated Image |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
example_7 for the prompts.| Entity Conditions | Generated Image |
|---|---|
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
![]() | ![]() |
Demonstration of the inpainting mode of EliGen, see entity_inpaint.py for generation prompts.
| Inpainting Input | Inpainting Output |
|---|---|
![]() | ![]() |
![]() | ![]() |
Demonstration of the styled entity control results with EliGen and IP-Adapter, see entity_control_ipadapter.py for generation prompts.
| Style Reference | Entity Control Variance 1 | Entity Control Variance 2 | Entity Control Variance 3 |
|---|---|---|---|
![]() | ![]() | ![]() | ![]() |
We also provide a demo of the styled entity control results with EliGen and specific styled lora, see ./styled_entity_control.py for details. Here is the visualization of EliGen with Lego dreambooth lora.
![]() | ![]() | ![]() | ![]() |
|---|---|---|---|
![]() | ![]() | ![]() | ![]() |
Demonstration of the entity transfer results with EliGen and In-Context LoRA, see entity_transfer.py for generation prompts.
| Entity to Transfer | Transfer Target Image | Transfer Example 1 | Transfer Example 2 |
|---|---|---|---|
![]() | ![]() | ![]() | ![]() |
5 commits