#191 · Primary category: Deep Learning Frameworks

classifier-free-guidance-pytorch

artificial-intelligence classifier-free-guidance deep-learning text-guidance

Implementation of Classifier Free Guidance in Pytorch, with emphasis on text conditioning, and flexibility to include multiple text embedding models

Project last updated:03/11/25

GitHub Stars

543

Forks

34

Contributors

2

License

MIT

Why we included this project

Classifier-free guidance is the standard way to make diffusion models follow text prompts, and this PyTorch library packages it as a focused component rather than a full pipeline. A text conditioner pulls in T5 or OpenCLIP embeddings, or both together the way eDiff-I does, and feeds them into your network's hidden layers through FiLM or cross-attention. The decorator is the part worth stealing: it wraps an existing nn.Module so your forward pass receives conditioning functions, and you enable guidance at inference by passing a cond_scale above one. That spares researchers and engineers from hand-writing the conditioning plumbing when they want text control on a custom architecture. It assumes you can wire your own training loop, so it suits teams that want a building block, not an end-to-end application.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category