Skip to content

Instantly share code, notes, and snippets.

View Manojbhat09's full-sized avatar

Manoj Bhat Manojbhat09

View GitHub Profile
@Manojbhat09
Manojbhat09 / flux_caching.py
Last active September 21, 2025 01:41
Minimal high-performance residual-based caching for DiT based diffusion models that reduces inference time by 30-70% through reuse of outputs on similarity
# caching.py
import functools
import unittest
import contextlib
import dataclasses
from collections import defaultdict
from typing import DefaultDict, Dict
import torch
from diffusers import DiffusionPipeline, FluxTransformer2DModel