Leffa: Controllable Person Image Generation with Flow Fields in Attention
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
Leffa is a unified framework for controllable person image generation, enabling precise manipulation of appearance through virtual try-on and pose via pose transfer. This project addresses the common issue of fine-grained textural detail distortion by learning flow fields in attention, guiding target queries to correct reference keys. It achieves state-of-the-art performance, maintaining high image quality while significantly reducing detail distortion.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
Leffa (Learning Flow Fields in Attention) is a cutting-edge, unified framework designed for controllable person image generation. Accepted to CVPR 2025, Leffa enables precise manipulation of both appearance, through virtual try-on, and pose, via pose transfer. Traditional methods often struggle with distorting fine-grained textural details from reference images, despite achieving high overall image quality. Leffa tackles this by explicitly guiding the target query to attend to the correct reference key within the attention layer during training, using a regularization loss on top of the attention map. This innovative approach significantly reduces fine-grained detail distortion while maintaining exceptional image quality.
Installation
To get started with Leffa, follow these steps to set up your environment:
conda create -n leffa python==3.10
conda activate leffa
cd Leffa
pip install -r requirements.txt
Examples
Leffa offers robust capabilities for both virtual try-on and pose transfer. The project includes a Gradio application for easy local execution and demonstration. You can also explore the official HuggingFace demo for interactive use. The visualization below showcases Leffa's ability to generate high-quality images with greatly reduced distortion of fine-grained details compared to other methods.
To run the Gradio app locally:
python app.py
Why Use Leffa?
Leffa stands out as a powerful tool for person image generation due to several key advantages:
- State-of-the-Art Performance: Achieves superior results in both virtual try-on and pose transfer tasks.
- Reduced Detail Distortion: Its unique "flow fields in attention" mechanism effectively preserves fine-grained textural details from reference images.
- Unified Framework: Provides a single, cohesive solution for two major controllable person image generation tasks.
- Model-Agnostic Loss: The proposed regularization loss can be applied to improve other diffusion models, showcasing its versatility.
- Active Development: Regularly updated with performance improvements and new features, as seen in the project's news section.
Links
- GitHub Repository: Leffa
- Paper: Learning Flow Fields in Attention for Controllable Person Image Generation
- HuggingFace Demo: Leffa Demo
- HuggingFace Models: Leffa Models
Related repositories
Similar repositories that may be relevant next.

LazyLLM: Low-Code Development for Multi-Agent LLM Applications
July 2, 2026
LazyLLM offers a low-code development tool designed for building multi-agent LLM applications with ease. It simplifies the creation of complex AI applications, providing a streamlined workflow for rapid prototyping, data feedback, and iterative optimization. Developers can leverage its extensive features for deployment, cross-platform compatibility, and efficient model fine-tuning.

ChatArena: Multi-Agent Language Game Environments for LLMs
July 1, 2026
ChatArena is a Python library designed to provide multi-agent language game environments for Large Language Models (LLMs), aiming to foster the development of communication and collaboration capabilities in AI. It offers a flexible framework for defining players, environments, and interactions based on Markov Decision Processes. Please note that as of August 11, 2025, this project has been deprecated due to a lack of widespread community use and is no longer receiving updates or support.
Agentarium: A Python Framework for AI Agent Simulations
July 1, 2026
Agentarium is an open-source Python framework designed for creating and managing simulations with AI-powered agents. It offers an intuitive platform for designing complex, interactive environments where agents can act, learn, and evolve. This powerful tool simplifies the orchestration of multiple AI agents and their interactions.
Lighteval: Your All-in-One Toolkit for LLM Evaluation
July 1, 2026
Lighteval is a comprehensive toolkit from Hugging Face for evaluating Large Language Models (LLMs) across various backends. It enables users to dive deep into model performance by saving detailed, sample-by-sample results and supports over 1000 evaluation tasks. The framework offers extensive customization options, allowing users to create custom tasks and metrics tailored to their specific needs.
Source repository
Open the original repository on GitHub.