IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Python class

FirstBlockCache

FirstBlockCache

class max.pipelines.diffusion.FirstBlockCache(dtype, device)

source

Bases: object

Standalone FirstBlockCache module.

Provides state allocation for FBCache. The conditional execution helpers (can_use_fbcache, fbcache_conditional_execution) remain in cache.py since they are used directly inside transformer _forward_fbcache methods.

Parameters:

create_state()

create_state(batch_size, seq_len, residual_dim, output_dim)

source

Allocate fresh per-request FirstBlockCache state tensors.

Parameters:

  • batch_size (int)
  • seq_len (int)
  • residual_dim (int)
  • output_dim (int)

Return type:

FirstBlockCacheState