SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2410.01723 · 2024

HarmoniCa: Harmonizing Training and Inference for Better Feature Caching in Diffusion Transformer Acceleration

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 15 functions out of this paper's own repositories and ran 10 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
modeltc/harmonica canonical 10 of 15
FunctionStatusWhere it lives
approx_standard_normal_cdf Ran modeltc/harmonica/diffusion/diffusion_utils.py
code served (permissive licence) · get_code("d6a68e210556f857")
continuous_gaussian_log_likelihood Ran modeltc/harmonica/diffusion/diffusion_utils.py
code served (permissive licence) · get_code("ab1c9568b4e13899")
get_2d_sincos_pos_embed Ran modeltc/harmonica/models/dynamic_models.py
code served (permissive licence) · get_code("c92c27c924b517e8")
get_beta_schedule Ran modeltc/harmonica/diffusion/gaussian_diffusion.py
code served (permissive licence) · get_code("3e0fa4efc22272d4")
get_lambda Ran modeltc/harmonica/train_router.py
code served (permissive licence) · get_code("495f938cb55dd81f")
get_named_beta_schedule Ran modeltc/harmonica/diffusion/gaussian_diffusion.py
code served (permissive licence) · get_code("36e30c7fb679ec78")
mean_flat Ran modeltc/harmonica/train_router.py
code served (permissive licence) · get_code("f6d7c009a8efb8b7")
modulate Ran modeltc/harmonica/models/dynamic_models.py
code served (permissive licence) · get_code("03310bba324ae4fb")
normal_kl Ran modeltc/harmonica/diffusion/diffusion_utils.py
code served (permissive licence) · get_code("8afbfc42c6ea0448")
space_timesteps Ran modeltc/harmonica/diffusion/respace.py
code served (permissive licence) · get_code("ea9dbc131adf582e")
create_logger Not yet run modeltc/harmonica/train_router.py
code served (permissive licence) · get_code("8382f7e48cc8a309")
create_named_schedule_sampler Not yet run modeltc/harmonica/diffusion/timestep_sampler.py
code served (permissive licence) · get_code("e48218d7d73db0b3")
download_model Not yet run modeltc/harmonica/download.py
code served (permissive licence) · get_code("6a0d5ecd441905cc")
find_model Not yet run modeltc/harmonica/download.py
code served (permissive licence) · get_code("29947a0a94157558")
get_2d_sincos_pos_embed_from_grid Not yet run modeltc/harmonica/models/dynamic_models.py
code served (permissive licence) · get_code("665d8a4e8f673a4c")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Diffusion Transformers (DiTs) excel in generative tasks but face practical deployment challenges due to high inference costs. Feature caching, which stores and retrieves redundant computations, offers the potential for acceleration. Existing learning-based caching, though adaptive, overlooks the impact of the prior timestep. It also suffers from misaligned objectives--aligned predicted noise vs. high-quality images--between training and inference. These two discrepancies compromise both performance and efficiency. To this end, we harmonize training and inference with a novel learning-based caching framework dubbed HarmoniCa. It first incorporates Step-Wise Denoising Training (SDT) to ensure the continuity of the denoising process, where prior steps can be leveraged. In addition, an Image Error Proxy-Guided Objective (IEPO) is applied to balance image quality against cache utilization through an efficient proxy to approximate the image error. Extensive experiments across $8$ models, $4$ samplers, and resolutions from $256\times256$ to $2K$ demonstrate superior performance and speedup of our framework. For instance, it achieves over $40\%$ latency reduction (i.e., $2.07\times$ theoretical speedup) and improved performance on PixArt-$α$. Remarkably, our image-free approach reduces training time by $25\%$ compared with the previous method. Our code is available at https://github.com/ModelTC/HarmoniCa.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2410.01723")
get_code_for_paper("2410.01723")
have("2410.01723")

Connect an agent — have() is free.