The emergence of diffusion models has greatly broadened the scope of high-fidelity image synthesis, resulting in notable advancements in both practical implementation and academic research. With the active adoption of the model in various real-world applications, the need for on-device deployment has grown considerably. However, deploying large diffusion models such as Stable Diffusion with more than one billion parameters to mobile devices poses distinctive challenges due to the limited computational and memory resources, which may vary according to the device. In this paper, we present the challenges and solutions for deploying Stable Diffusion on mobile devices with TensorFlow Lite framework, which supports both iOS and Android devices. The resulting Mobile Stable Diffusion achieves the inference latency of smaller than 7 seconds for a 512x512 image generation on Android devices with mobile GPUs.
翻译:扩散模型的兴起极大地拓展了高保真图像合成的范围,在实践应用和学术研究中均取得了显著进展。随着该模型在各行各业实际场景中的积极应用,设备端部署的需求日益增长。然而,将参数超过十亿的扩散模型(如Stable Diffusion)部署到移动设备上,面临计算与内存资源受限(且因设备而异)的特殊挑战。本文介绍了基于TensorFlow Lite框架(该框架支持iOS与Android设备)在移动设备上部署Stable Diffusion的挑战与解决方案。最终实现的Mobile Stable Diffusion在搭载移动GPU的安卓设备上,生成512x512分辨率图像的推理延迟可控制在7秒以内。