Skip to main content
QUICK REVIEW

[论文解读] PAI-Diffusion: Constructing and Serving a Family of Open Chinese Diffusion Models for Text-to-image Synthesis on the Cloud

Chengyu Wang, Zhongjie Duan|arXiv (Cornell University)|Sep 11, 2023
Generative Adversarial Networks and Image SynthesisComputer Science被引用 3
一句话总结

PAI-Diffusion 推出了一套开源的中文扩散模型家族,包括通用型和领域特定的变体,并通过 LoRA 和 ControlNet 实现细粒度图像编辑。该框架通过集成的工具(如中文 WebUI 和 diffusers-api)实现可扩展的云端文本到图像生成,在保持高质量输出的同时,利用 PAI-Blade 优化实现 2–3× 的推理速度提升。

ABSTRACT

Text-to-image synthesis for the Chinese language poses unique challenges due to its large vocabulary size, and intricate character relationships. While existing diffusion models have shown promise in generating images from textual descriptions, they often neglect domain-specific contexts and lack robustness in handling the Chinese language. This paper introduces PAI-Diffusion, a comprehensive framework that addresses these limitations. PAI-Diffusion incorporates both general and domain-specific Chinese diffusion models, enabling the generation of contextually relevant images. It explores the potential of using LoRA and ControlNet for fine-grained image style transfer and image editing, empowering users with enhanced control over image generation. Moreover, PAI-Diffusion seamlessly integrates with Alibaba Cloud's Machine Learning Platform for AI, providing accessible and scalable solutions. All the Chinese diffusion model checkpoints, LoRAs, and ControlNets, including domain-specific ones, are publicly available. A user-friendly Chinese WebUI and the diffusers-api elastic inference toolkit, also open-sourced, further facilitate the easy deployment of PAI-Diffusion models in various environments, making it a valuable resource for Chinese text-to-image synthesis.

研究动机与目标

  • 为解决中文文本到图像生成面临的挑战,包括语言词汇量庞大及字符间复杂依赖关系。
  • 开发一个全面的框架,支持中文语境下的通用与领域特定图像生成,如诗歌、饮食与传统艺术。
  • 通过集成 LoRA 和 ControlNet 实现对图像生成过程的细粒度控制,支持风格迁移与图像编辑。
  • 通过阿里云 PAI 平台实现可扩展的云原生部署,并结合开源工具包提升广泛可及性。
  • 将所有模型、LoRA、ControlNet 及工具包以开源许可证发布,以促进社区协作与创新。

提出的方法

  • 该框架采用在多样化中文图文数据集上预训练的一系列扩散模型家族,针对特定领域(如中餐、古典诗歌)设有专门变体。
  • 应用 LoRA(低秩适应)实现高效微调与风格迁移,使用户可在不重新训练完整模型的前提下修改视觉属性。
  • 集成 ControlNet 以基于姿态、深度或语义分割图等条件引导图像生成,实现精确编辑与布局控制。
  • 通过 diffusers-api 工具包将模型暴露为 RESTful Web 服务,支持文本到图像、图像到图像及图像修复等多种推理任务。
  • 使用 PAI-Blade(AI 编译器)对推理过程进行优化,与原生 PyTorch 相比,端到端延迟和 GPU 显存占用最高降低 18%。
  • 定制化的中文 WebUI 扩展提升了 Stable Diffusion WebUI 对中文提示词的处理能力与用户体验。

实验结果

研究问题

  • RQ1如何有效适配扩散模型以应对中文语言的复杂性,包括其庞大的词汇量和字符级依赖关系?
  • RQ2领域特定的微调在多大程度上能提升生成图像在特定中文文化语境下的相关性与质量?
  • RQ3LoRA 与 ControlNet 是否能有效用于实现中文文本到图像生成中对图像风格与构图的细粒度控制?
  • RQ4基于云的部署与优化推理在多大程度上影响中文扩散模型的可扩展性、性能与可访问性?
  • RQ5在真实部署场景中,使用编译器优化的推理管道(PAI-Blade)相比标准 PyTorch 推理,性能提升如何?

主要发现

  • 在 NVIDIA A10 GPU 上,diffusers-api 工具包实现了平均 2.96 秒的推理时间,相比原生 PyTorch 实现(6.34 秒)提升了 2.14 倍。
  • 使用优化后的 diffusers-api 推理管道,GPU 显存消耗从 6.94 GB 降低至 5.56 GB,表明资源效率显著提升。
  • 该框架成功支持多种领域专用模型,包括中餐、诗歌与传统绘画,实现上下文相关的图像生成。
  • LoRA 与 ControlNet 在中文模型上成功部署,使用户能够以高精度操控图像风格与结构。
  • 所有模型检查点、LoRA、ControlNet 及工具包(WebUI 与 diffusers-api)的开源发布,使该技术可在多样化环境中广泛采用与自定义。
  • 性能基准测试证实,PAI-Blade 优化在保持全精度的同时,显著降低了云端推理的延迟与显存占用。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。