In-Context LoRA for Diffusion Transformers

Lianghua Huang, Wei Wang, Zhi-Fan Wu, Yupeng Shi, Huanzhang Dou +4 more
10/31/2024
cs.CVcs.GR

Official code: ali-vilab/In-Context-LoRA (2,083 stars, last commit 2024-12-20). 1 more implementation below.

Abstract

Recent research arXiv:2410.15027 has explored the use of diffusion transformers (DiTs) for task-agnostic image generation by simply concatenating attention tokens across images. However, despite substantial computational resources, the fidelity of the generated images remains suboptimal. In this study, we reevaluate and streamline this framework by hypothesizing that text-to-image DiTs inherently possess in-context generation capabilities, requiring only minimal tuning to activate them. Through diverse task experiments, we qualitatively demonstrate that existing text-to-image DiTs can effectively perform in-context generation without any tuning. Building on this insight, we propose a remarkably simple pipeline to leverage the in-context abilities of DiTs: (1) concatenate images instead of tokens, (2) perform joint captioning of multiple images, and (3) apply task-specific LoRA tuning using small datasets (e.g., 20~100 samples) instead of full-parameter tuning with large datasets. We name our models In-Context LoRA (IC-LoRA). This approach requires no modifications to the original DiT models, only changes to the training data. Remarkably, our pipeline generates high-fidelity image sets that better adhere to prompts. While task-specific in terms of tuning data, our framework remains task-agnostic in architecture and pipeline, offering a powerful tool for the community and providing valuable insights for further research on product-level task-agnostic generation systems. We release our code, data, and models at https://github.com/ali-vilab/In-Context-LoRA

View on arXivView PDF

Code Implementations(2)

Official repository of In-Context LoRA for Diffusion Transformers

2,08395Nov 1, 20241 years ago

Unofficial reproduction of the paper "In-Context LoRA for Diffusion Transformers" (arXiv:2410.23775). This repository provides a full pipeline for data preprocessing, caption generation, model training, and inference.

00PythonMay 19, 20251 years ago

Similar Papers

Cite this paper

@article{huang2024incontext,
  title  = {In-Context LoRA for Diffusion Transformers},
  author = {Lianghua Huang and Wei Wang and Zhi-Fan Wu and Yupeng Shi and Huanzhang Dou and Chen Liang and Yutong Feng and Yu Liu and Jingren Zhou},
  year   = {2024},
  eprint = {2410.23775},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.23775v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.23775.svg)](https://codeofpaper.com/paper/2410.23775)

Discussion