UNO

bytedanceApache-2.0长期未更新

UNO 是字节跳动开源的通用图像定制方法,基于扩散 Transformer,用同一套框架同时支持单主体和多主体参考图生成,解决多主体一致性难的问题。

[ICCV 2025] 🔥🔥 UNO: A Universal Customization Method for Both Single and Multi-Subject Conditioning

暂无版本1,363star80fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
pip install -e .
python app.py --offload --name flux-dev-fp8
硬件要求按 README 说明

README 说明 fp8 加 offload 模式峰值显存约 16GB,可在消费级 GPU 上运行;RTX 3090 上 fp8 加 offload 端到端推理约 40 秒到 1 分钟。使用 AMD GPU、NV RTX50 系列或 macOS MPS 时需自行安装对应 torch 版本。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

字节开源的主体定制图像生成模型,支持单主体和多主体参考图生成

UNO 是字节跳动开源的通用图像定制方法,基于扩散 Transformer,用同一套框架同时支持单主体和多主体参考图生成,解决多主体一致性难的问题。

核心能力

  • 统一模型同时支持单主体与多主体条件生成
  • 用渐进式跨模态对齐和通用旋转位置嵌入训练
  • 基于 FLUX.1-dev 从文生图模型迭代训练而来
  • 提供 fp8 加 offload 低显存推理模式
  • 开源 UNO-1M 约百万对图像训练数据集

容易踩的坑

首次运行会自动从 HuggingFace 下载 FLUX.1-dev、T5、CLIP、UNO 等检查点,共约 37GB 磁盘空间;需 Python 3.10 到 3.12,AMD GPU、RTX50 系列或 macOS MPS 要先自行装好匹配的 torch;跑 dreambench 评测前需先执行 git submodule update --init 拉取数据集子模块。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    🔥 News

    • 2025.09.12 🔥 UMO is here! It can freely combine one-to-many identity with any subjects in any scenarios, delivering outputs with high subject/identity consistency. You now can experience a more powerful UNO or OmniGen2 here! You can also visit our project page for more examples. 🔥
    • 2025.08.29 🔥 We are excited to share our new open-source project USO, which can freely combine any subjects with any styles in any scenarios while ensuring photorealistic results. You can also visit our project page or try the live demo for more examples. 🔥
    • 2025.08.18 ✨ We open-sourced the UNO-1M dataset, which is a large and high-quality dataset (~1M paired images). We hope it can further benefit research.
    • 2025.06.26 🎉 Congratulations! UNO has been accepted by ICCV 2025!
    • 2025.04.16 🔥 Our companion project RealCustom is released.
    • 2025.04.10 🔥 Update fp8 mode as a primary low vmemory usage support. Gift for consumer-grade GPU users. The peak Vmemory usage is ~16GB now. We may try further inference optimization later.
    • 2025.04.03 🔥 The demo of UNO is released.
    • 2025.04.03 🔥 The training code, inference code, and model of UNO are released.
    • 2025.04.02 🔥 The project page of UNO is created.
    • 2025.04.02 🔥 The arXiv paper of UNO is released.

    📖 Introduction

    In this study, we propose a highly-consistent data synthesis pipeline to tackle this challenge. This pipeline harnesses the intrinsic in-context generation capabilities of diffusion transformers and generates high-consistency multi-subject paired data. Additionally, we introduce UNO, which consists of progressive cross-modal alignment and universal rotary position embedding. It is a multi-image conditioned subject-to-image model iteratively trained from a text-to-image model. Extensive experiments show that our method can achieve high consistency while ensuring controllability in both single-subject and multi-subject driven generation.

    ⚡️ Quick Start

    🔧 Requirements and Installation

    Install the requirements

    # pip install -r requirements.txt # legacy installation command
    
    ## create a virtual environment with python >= 3.10 <= 3.12, like
    # python -m venv uno_env
    # source uno_env/bin/activate
    # or
    # conda create -n uno_env python=3.10 -y
    # conda activate uno_env
    # then install the requirements by you need
    
    # !!! if you are using amd GPU/NV RTX50 series/macos MPS, you should install the correct torch version by yourself first
    # !!! then run the install command
    pip install -e .  # for who wanna to run the demo/inference only
    pip install -e .[train]  # for who also want to train the model
    

    then download checkpoints in one of the three ways:

    1. Directly run the inference scripts, the checkpoints will be downloaded automatically by the hf_hub_download function in the code to your $HF_HOME(the default value is ~/.cache/huggingface).
    2. use huggingface-cli download <repo name> to download black-forest-labs/FLUX.1-dev, xlabs-ai/xflux_text_encoders, openai/clip-vit-large-patch14, bytedance-research/UNO, then run the inference scripts. You can just download the checkpoint in need only to speed up your set up and save your disk space. i.e. for black-forest-labs/FLUX.1-dev use huggingface-cli download black-forest-labs/FLUX.1-dev flux1-dev.safetensors and huggingface-cli download black-forest-labs/FLUX.1-dev ae.safetensors, ignoreing the text encoder in black-forest-labes/FLUX.1-dev model repo(They are here for diffusers call). All of the checkpoints will take 37 GB of disk space.
    3. use huggingface-cli download <repo name> --local-dir <LOCAL_DIR> to download all the checkpoints mentioned in 2. to the directories your want. Then set the environment variable AE, FLUX_DEV(or FLUX_DEV_FP8 if you use fp8 mode), T5, CLIP, LORA to the corresponding paths. Finally, run the inference scripts.
    4. If you already have some of the checkpoints, you can set the environment variable AE, FLUX_DEV, T5, CLIP, LORA to the corresponding paths. Finally, run the inference scripts.

    🌟 Gradio Demo

    python app.py
    

    For low vmemory usage, please pass the --offload and --name flux-dev-fp8 args. The peak memory usage will be 16GB. Just for reference, the end2end inference time is 40s to 1min on RTX 3090 in fp8 and offload mode.

    python app.py --offload --name flux-dev-fp8
    

    ✍️ Inference

    Start from the examples below to explore and spark your creativity. ✨

    python inference.py --prompt "A clock on the beach is under a red sun umbrella" --image_paths "assets/clock.png" --width 704 --height 704
    python inference.py --prompt "The figurine is in the crystal ball" --image_paths "assets/figurine.png" "assets/crystal_ball.png" --width 704 --height 704
    python inference.py --prompt "The logo is printed on the cup" --image_paths "assets/cat_cafe.png" "assets/cup.png" --width 704 --height 704
    

    Optional prepreration: If you want to test the inference on dreambench at the first time, you should clone the submodule dreambench to download the dataset.

    git submodule update --init
    

    Then running the following scripts:

    # inference on dreambench
    ## for single-subject
    python inference.py --eval_json_path ./datasets/dreambench_singleip.json
    ## for multi-subject
    python inference.py --eval_json_path ./datasets/dreambench_multiip.json
    

    🔍 Evaluation

    # evaluated on dreambench
    ## for single-subject
    python eval/evaluate_clip_dino_score_single_subject.py --result_root <your_image_result_save_path> -save_dir <the_evaluation_result_save_path>
    ## for multi-subject
    python eval/evaluate_clip_dino_score_multi_subject.py --result_root <your_image_result_save_path> -save_dir <the_evaluation_result_save_path>
    

    🚄 Training

    If you want to train on UNO-1M, you need to download the dataset from HuggingFace, extract and put it in ./datasets/UNO-1M. The directory will be like:

    ├── datasets
    │   └── UNO-1M
    │       ├── images
    │       │   ├── split1
    │       │   │   ├── object365_w1024_h1536_split_Bread_0_0_1_725x1024.png
    │       │   │   ├── object365_w1024_h1536_split_Bread_0_0_2_811x1024.png
    │       │   │   └── ...
    │       │   └── ...
    │       └── uno_1m_total_labels.json
    

    Then run the training script:

    # filter and format the dataset
    python uno/utils/filter_uno_1m_dataset.py ./datasets/UNO-1M/uno_1m_total_labels.json ./datasets/UNO-1M/uno_1m_total_labels_convert.json 4
    
    # train
    accelerate launch train.py --train_data_json ./datasets/UNO-1M/uno_1m_total_labels_convert.json
    

    📌 Tips and Notes

    We integrate single-subject and multi-subject generation within a unified model. For single-subject scenarios, the longest side of the reference image is set to 512 by default, while for multi-subject scenarios, it is set to 320. UNO demonstrates remarkable flexibility across various aspect ratios, thanks to its training on a multi-scale dataset. Despite being trained within 512 buckets, it can handle higher resolutions, including 512, 568, and 704, among others.

    UNO excels in subject-driven generation but has room for improvement in generalization due to dataset constraints. We are actively developing an enhanced model—stay tuned for updates. Your feedback is valuable, so please feel free to share any suggestions.

    🎨 Application Scenarios

    📄 Disclaimer

    🚀 Updates

    For the purpose of fostering research and the open-source community, we plan to open-source the entire project, encompassing training, inference, weights, etc. Thank you for your patience and support! 🌟

    • Release github repo.
    • Release inference code.
    • Release training code.
    • Release model checkpoints.
    • Release arXiv paper.
    • Release huggingface space demo.
    • Release in-context data generation pipelines (instructions provided in ./template).
    • Release dataset (UNO-1M).

    Related resources

    ComfyUI

    We thanks the passionate community contributors, since we have reviced many requests about comfyui, but there aren't so much time to make so many adaptations by ourselves. if you wanna try our work in comfyui, you can try the above repos. Remember, they are slightly different, so you may need some trail and error to make find the best match repo for you.

    Citation

    If UNO is helpful, please help to ⭐ the repo.

    If you find this project useful for your research, please consider citing our paper:

    @article{wu2025less,
      title={Less-to-More Generalization: Unlocking More Controllability by In-Context Generation},
      author={Wu, Shaojin and Huang, Mengqi and Wu, Wenxu and Cheng, Yufeng and Ding, Fei and He, Qian},
      journal={arXiv preprint arXiv:2504.02160},
      year={2025}
    }