MagCache state management.
This module contains the MagCacheState class which manages the internal state for MagCache caching logic, including residuals, accumulated metrics, and step tracking.
MagCacheState
State management for MagCache caching logic.
accumulated_err instance-attribute
accumulated_err: float = 0.0
accumulated_ratio instance-attribute
accumulated_ratio: float = 1.0
accumulated_steps instance-attribute
accumulated_steps: int = 0
calibration_ratios instance-attribute
cos_dises instance-attribute
head_block_input: Tensor | tuple[Tensor, Tensor] | None = (
None
)
norm_ratios instance-attribute
norm_stds instance-attribute
previous_residual instance-attribute
previous_residual: Tensor | tuple[Tensor, Tensor] | None = (
None
)
should_compute instance-attribute
should_compute: bool = True
step_index instance-attribute
reset
Reset all state variables for a new inference run.