Emu3.5:基于多模态技术的世界建模与生成项目

Native Multimodal Models are World Learners

Branch1Tags0
FilesLast commitLast update
11 months ago
10 months ago
11 months ago
10 months ago
11 months ago
1 year ago
1 year ago
10 months ago
11 months ago
11 months ago
1 year ago
11 months ago
11 months ago

Emu3.5:原生多模态模型是世界学习者

Emu3.5团队,北京人工智能研究院(BAAI)

项目页面 | 🤗HF模型 | 论文 | 应用

🔔 最新动态:Emu3.5网页版与移动端应用以及vLLM离线推理已正式上线——详情请见🔥 新闻。

架构图
架构图
🔹 核心概念 描述
🧠 统一世界建模 联合预测视觉和语言的下一状态,实现连贯的世界建模与生成。
🧩 端到端预训练 通过统一的下一个token预测目标,在交错的视觉-语言序列上进行训练。
📚 超10万亿多模态token 在来自视频帧和文字记录的超10万亿交错token上进行预训练,捕捉时空结构。
🔄 原生多模态输入输出 处理并生成交错的视觉-文本序列,无需模态适配器或特定任务头。
🎯 强化学习后训练 大规模强化学习提升推理能力、组合能力和生成质量。
⚡ 离散扩散适配(DiDA) 将顺序解码转换为双向并行预测,实现约20倍更快的推理速度且无性能损失。
🖼️ 多样化生成 在长序列视觉-语言生成、任意到图像(X2I)合成以及富文本图像创建方面表现出色。
🌐 可泛化世界建模 支持时空一致的世界探索,以及在各种场景下的开放世界具身操作。
🏆 性能基准 在图像生成/编辑任务上与Gemini 2.5 Flash Image(Nano Banana) 相当,在交错生成任务上表现更优。

🔥 最新动态

  • 2025-11-28 · 🌐 Emu3.5 网页及移动应用正式上线 — 官方产品体验现已在网页端开放,中国大陆用户可访问 zh.emu.world,全球用户可访问 emu.world 🎉 新版首页突出展示精选案例和“开始使用”入口,工作区及移动应用则整合了创作、灵感动态、历史记录、个人资料和语言切换功能,支持网页端、Android APK 及 H5 版本。(详情见下文#官方网页与移动应用。)
  • 2025-11-19 · 🚀 vLLM 离线推理功能发布 — 推出 inference_vllm.py,新增条件/无条件批处理调度器,在 vLLM 0.11.0 上,Emu3.5 各项任务的端到端生成速度提升4-5 倍。详见#使用 vLLM 进行推理的设置指南,完整细节可查看 PR #47。
  • 2025-11-17 · 🎛️ Gradio 演示(Transformers 后端) — 针对标准 Transformers 运行时,引入 gradio_demo_image.py 和 gradio_demo_interleave.py 预设,提供开箱即用的文本生成图像(T2I)/跨模态生成图像(X2I)以及交错生成体验,并支持流式输出。可尝试#Gradio 演示中的命令在本地启动两个界面。

目录

  1. 模型与权重
  2. 快速开始
  3. Gradio 演示
  4. 时间规划
  5. 引用

1. 模型与权重

模型名称 Hugging Face 权重
Emu3.5 🤗 HF 链接
Emu3.5-Image 🤗 HF 链接
Emu3.5-VisionTokenizer 🤗 HF 链接

注:

  • Emu3.5 支持通用多模态预测,包括交错图像-文本生成和单图像生成(T2I/X2I)任务。
  • Emu3.5-Image 是专注于 T2I/X2I 任务的模型,在这些场景下性能最佳。
  • 两个模型均为纯下一个token预测器,未启用 DiDA 加速(生成单张图像可能需要数分钟)。
  • ⚡ 敬请期待 DiDA 加速权重。

💡 使用提示:
若需进行交错图像-文本生成,请使用 Emu3.5。
若需进行单图像生成(T2I 和 X2I),请使用 Emu3.5-Image 以获得最佳质量。

2. 快速开始

环境设置

# Requires Python 3.12 or higher.
git clone https://github.com/baaivision/Emu3.5
cd Emu3.5
pip install -r requirements/transformers.txt
pip install flash_attn==2.8.3 --no-build-isolation

配置

编辑 configs/config.py 以进行以下设置:

  • 路径:model_path、vq_path 您可以使用本地路径(例如,已下载的 HuggingFace 权重)或远程 HuggingFace Hub ID 进行自动下载:
    vq_path = "BAAI/Emu3.5-VisionTokenizer"  # 远程,自动下载
    model_path = "BAAI/Emu3.5"               # 远程,自动下载
    # 或者
    vq_path = "/path/to/local/Emu3.5-VisionTokenizer"  # 本地路径
    model_path = "/path/to/local/Emu3.5"               # 本地路径
    
  • 任务模板:task_type in {t2i, x2i, howto, story, explore, vla}
  • 输入图像:use_image(若要提供参考图像,设为 True,控制 <|IMAGE|> 令牌);在每个提示中设置 reference_image 以指定图像路径。对于 x2i 任务,建议将 reference_image 用作包含单张/多张图像路径的列表,以兼容多图像输入。
  • 采样:sampling_params(无分类器引导、温度、top_k/top_p 等)
  • 宽高比(适用于 t2i 任务):aspect_ratio("4:3"、"21:9"、"1:1"、"auto" 等)

运行推理

python inference.py --cfg configs/config.py

按任务划分的示例配置

以下是不同任务的示例命令。 请根据您可用的 GPU 设置 CUDA_VISIBLE_DEVICES。

# 🖼️ Text-to-Image (T2I) task
CUDA_VISIBLE_DEVICES=0 python inference.py --cfg configs/example_config_t2i.py

# 🔄 Any-to-Image (X2I) task
CUDA_VISIBLE_DEVICES=0,1 python inference.py --cfg configs/example_config_x2i.py

# 🎯 Visual Guidance task
CUDA_VISIBLE_DEVICES=0,1 python inference.py --cfg configs/example_config_visual_guidance.py

# 📖 Visual Narrative task
CUDA_VISIBLE_DEVICES=0,1 python inference.py --cfg configs/example_config_visual_narrative.py


# After running inference, the model will generate results in protobuf format (.pb files) for each input prompt.

Protobuf 输出将写入 outputs/<exp_name>/proto/。为获得更佳吞吐量,建议使用 ≥2 块 GPU。

使用 vLLM 运行推理

vLLM 环境设置

  1. [可选推荐] 为 vLLM 后端使用新的虚拟环境。
conda create -n Emu3p5 python=3.12
  1. 安装 vLLM 并应用补丁文件。
# Requires Python 3.12 or higher.
# Recommended: CUDA 12.8.
pip install -r requirements/vllm.txt
pip install flash_attn==2.8.3 --no-build-isolation

cd Emu3.5
python src/patch/apply.py

按任务划分的示例配置

# 🖼️ Text-to-Image (T2I) task
CUDA_VISIBLE_DEVICES=0,1 python inference_vllm.py --cfg configs/example_config_t2i.py

# 🔄 Any-to-Image (X2I) task
CUDA_VISIBLE_DEVICES=0,1 python inference_vllm.py --cfg configs/example_config_x2i.py

# 🎯 Visual Guidance task
CUDA_VISIBLE_DEVICES=0,1 python inference_vllm.py --cfg configs/example_config_visual_guidance.py

# 📖 Visual Narrative task
CUDA_VISIBLE_DEVICES=0,1 python inference_vllm.py --cfg configs/example_config_visual_narrative.py

可视化 Protobuf 输出

如需可视化生成的 protobuf 文件(--video:为交错输出生成视频可视化):

python src/utils/vis_proto.py --input <input_proto_path> [--output <output_dir>] [--video]
  • --input:支持单个 .pb 文件或目录;目录将被递归扫描。
  • --output:可选;文件的默认值为 <input_dir>/results/<file_stem>,目录的默认值为 <parent_dir_of_input>/results。

预期的输出目录结构(示例):

results/<pb_name>/
├── 000_question.txt
├── 000_global_cot.txt
├── 001_text.txt
├── 001_00_image.png
├── 001_00_image_cot.txt
├── 002_text.txt
├── 002_00_image.png
├── ...
└── video.mp4              # only when --video is enabled

每个 *_text.txt 存储解码后的片段,*_image.png 存储生成的帧,对应的 *_image_cot.txt 在有可用信息时保存图像级别的思维链笔记。

3. Gradio 演示

我们针对不同的应用场景提供了两个 Gradio 演示:

Emu3.5-Image 演示 —— 为文本到图像(T2I)和任意到图像(X2I)任务优化的交互式界面:

CUDA_VISIBLE_DEVICES=0,1 python gradio_demo_image.py --host 0.0.0.0 --port 7860

Emu3.5-Interleave 演示 —— 启动 Emu3.5 交错任务(视觉引导与视觉叙事)Gradio 演示

CUDA_VISIBLE_DEVICES=0,1 python gradio_demo_interleave.py --host 0.0.0.0 --port 7860

功能特点

  • 图像生成:支持文本到图像生成及多模态图像生成
  • 交错生成:支持图像与文本交替生成的长序列创作
  • 多样化T2I宽高比:9种预设宽高比(4:3、16:9、1:1等)及自动模式
  • 思维链展示:自动解析并格式化模型的内部思考过程
  • 实时流式生成:文本与图像生成过程实时流式更新

官方网页与移动应用

  • 网页端:可在zh.emu.world(中国大陆)和emu.world(全球)体验生产级别的Emu3.5服务,包含精选首页、“创作”工作区、灵感动态、历史记录、个人资料及语言切换功能。
  • 移动端(Android APK及H5):移动客户端提供与网页端一致的核心流程——基于提示词的创作、“灵感”画廊、个人中心以及反馈与隐私入口,并根据系统设置自动选择UI语言。
  • 文档:有关产品使用详情,请参阅Emu3.5 AI 使用指南(中文) 和Emu3.5 AI User Guide(英文):

移动应用下载(二维码)

Emu3.5 Mobile App (Mainland China)
Emu3.5移动应用 · 中国大陆
Emu3.5 Mobile App (Global)
Emu3.5移动应用 · 全球

4. 开发计划

5. 引用

@misc{cui2025emu35nativemultimodalmodels,
      title={Emu3.5: Native Multimodal Models are World Learners}, 
      author={Yufeng Cui and Honghao Chen and Haoge Deng and Xu Huang and Xinghang Li and Jirong Liu and Yang Liu and Zhuoyan Luo and Jinsheng Wang and Wenxuan Wang and Yueze Wang and Chengyuan Wang and Fan Zhang and Yingli Zhao and Ting Pan and Xianduo Li and Zecheng Hao and Wenxuan Ma and Zhuo Chen and Yulong Ao and Tiejun Huang and Zhongyuan Wang and Xinlong Wang},
      year={2025},
      eprint={2510.26583},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2510.26583}, 
}

Introduction

原生多模态模型是世界学习者【此简介由AI生成】

Customize your domain
121.57 K68Visit GitHub