From c38223783353357f9349547895cfe6038bd3f33e Mon Sep 17 00:00:00 2001 From: mi804 <1576993271@qq.com> Date: Tue, 4 Mar 2025 20:04:24 +0800 Subject: [PATCH] update eligen from huggingface --- README.md | 2 +- examples/EntityControl/README.md | 2 +- examples/EntityControl/entity_control.py | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 79c435c..a5993a4 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ Until now, DiffSynth Studio has supported the following models: - **December 31, 2024** We propose EliGen, a novel framework for precise entity-level controlled text-to-image generation, complemented by an inpainting fusion pipeline to extend its capabilities to image inpainting tasks. EliGen seamlessly integrates with existing community models, such as IP-Adapter and In-Context LoRA, enhancing its versatility. For more details, see [./examples/EntityControl](./examples/EntityControl/). - Paper: [EliGen: Entity-Level Controlled Image Generation with Regional Attention](https://arxiv.org/abs/2501.01097) - - Model: [ModelScope](https://www.modelscope.cn/models/DiffSynth-Studio/Eligen) + - Model: [ModelScope](https://www.modelscope.cn/models/DiffSynth-Studio/Eligen), [HuggingFace](https://huggingface.co/modelscope/EliGen) - Online Demo: [ModelScope EliGen Studio](https://www.modelscope.cn/studios/DiffSynth-Studio/EliGen) - Training Dataset: [EliGen Train Set](https://www.modelscope.cn/datasets/DiffSynth-Studio/EliGenTrainSet) diff --git a/examples/EntityControl/README.md b/examples/EntityControl/README.md index 9f0233e..2e0530f 100644 --- a/examples/EntityControl/README.md +++ b/examples/EntityControl/README.md @@ -6,7 +6,7 @@ We propose EliGen, a novel approach that leverages fine-grained entity-level inf * Paper: [EliGen: Entity-Level Controlled Image Generation with Regional Attention](https://arxiv.org/abs/2501.01097) * Github: [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) -* Model: [ModelScope](https://www.modelscope.cn/models/DiffSynth-Studio/Eligen) +* Model: [ModelScope](https://www.modelscope.cn/models/DiffSynth-Studio/Eligen), [HuggingFace](https://huggingface.co/modelscope/EliGen) * Online Demo: [ModelScope EliGen Studio](https://www.modelscope.cn/studios/DiffSynth-Studio/EliGen) * Training Dataset: [EliGen Train Set](https://www.modelscope.cn/datasets/DiffSynth-Studio/EliGenTrainSet) diff --git a/examples/EntityControl/entity_control.py b/examples/EntityControl/entity_control.py index 12c7f69..a3ab08b 100644 --- a/examples/EntityControl/entity_control.py +++ b/examples/EntityControl/entity_control.py @@ -27,11 +27,20 @@ def example(pipe, seeds, example_id, global_prompt, entity_prompts): # download and load model model_manager = ModelManager(torch_dtype=torch.bfloat16, device="cuda", model_id_list=["FLUX.1-dev"]) +# set download_from_modelscope = False if you want to download model from huggingface +download_from_modelscope = True +if download_from_modelscope: + model_id = "DiffSynth-Studio/Eligen" + downloading_priority = ["ModelScope"] +else: + model_id = "modelscope/EliGen" + downloading_priority = ["HuggingFace"] model_manager.load_lora( download_customized_models( - model_id="DiffSynth-Studio/Eligen", + model_id=model_id, origin_file_path="model_bf16.safetensors", - local_dir="models/lora/entity_control" + local_dir="models/lora/entity_control", + downloading_priority=downloading_priority ), lora_alpha=1 )