SYMBOL INDEX (1198 symbols across 124 files) FILE: deepcompressor/app/diffusion/cache/config.py class DiffusionQuantCacheConfig (line 19) | class DiffusionQuantCacheConfig(BasePathConfig): method simplify_path (line 39) | def simplify_path(path: str, key_map: dict[str, set[str]]) -> str: method simplify (line 63) | def simplify(self, key_map: dict[str, set[str]]) -> tp.Self: class DiffusionPtqCacheConfig (line 70) | class DiffusionPtqCacheConfig: FILE: deepcompressor/app/diffusion/config.py class DiffusionPtqRunConfig (line 34) | class DiffusionPtqRunConfig: method __post_init__ (line 76) | def __post_init__(self): method generate_default_dirname (line 158) | def generate_default_dirname(self) -> str: method get_parser (line 186) | def get_parser(cls) -> ConfigParser: FILE: deepcompressor/app/diffusion/dataset/base.py class DiffusionDataset (line 18) | class DiffusionDataset(torch.utils.data.Dataset): method __init__ (line 23) | def __init__(self, path: str, num_samples: int = -1, seed: int = 0, ex... method __len__ (line 38) | def __len__(self) -> int: method __getitem__ (line 41) | def __getitem__(self, idx) -> dict[str, tp.Any]: method build_loader (line 65) | def build_loader(self, **kwargs) -> torch.utils.data.DataLoader: FILE: deepcompressor/app/diffusion/dataset/calib.py class DiffusionCalibCacheLoaderConfig (line 44) | class DiffusionCalibCacheLoaderConfig(BaseDataLoaderConfig): method build_dataset (line 63) | def build_dataset(self) -> "DiffusionCalibDataset": method build_loader (line 67) | def build_loader(self) -> "DiffusionCalibCacheLoader": class DiffusionCalibDataset (line 72) | class DiffusionCalibDataset(DiffusionDataset): method __init__ (line 75) | def __init__(self, path: str, num_samples: int = -1, seed: int = 0) ->... method __len__ (line 81) | def __len__(self) -> int: method __getitem__ (line 84) | def __getitem__(self, idx) -> dict[str, tp.Any]: class DiffusionConcatCacheAction (line 88) | class DiffusionConcatCacheAction(ConcatCacheAction): method info (line 89) | def info( class DiffusionCalibCacheLoader (line 137) | class DiffusionCalibCacheLoader(BaseCalibCacheLoader): method __init__ (line 141) | def __init__(self, config: DiffusionCalibCacheLoaderConfig) -> None: method _init_cache (line 152) | def _init_cache(self, name: str, module: nn.Module) -> IOTensorsCache: method iter_samples (line 188) | def iter_samples(self) -> tp.Generator[ModuleForwardInput, None, None]: method _convert_layer_inputs (line 195) | def _convert_layer_inputs( method _convert_layer_outputs (line 239) | def _convert_layer_outputs(self, m: nn.Module, outputs: tp.Any) -> dic... method iter_layer_activations (line 259) | def iter_layer_activations( # noqa: C901 FILE: deepcompressor/app/diffusion/dataset/collect/calib.py function process (line 21) | def process(x: torch.Tensor) -> torch.Tensor: function collect (line 26) | def collect(config: DiffusionPtqRunConfig, dataset: datasets.Dataset): class CollectConfig (line 93) | class CollectConfig: FILE: deepcompressor/app/diffusion/dataset/collect/utils.py class CollectHook (line 21) | class CollectHook: method __init__ (line 22) | def __init__(self, caches: list[dict[str, tp.Any]] = None, zero_redund... method __call__ (line 26) | def __call__( FILE: deepcompressor/app/diffusion/dataset/data/COCO/COCO.py function hash_string_to_int (line 89) | def hash_string_to_int(s: str) -> int: class COCOConfig (line 97) | class COCOConfig(datasets.BuilderConfig): method __init__ (line 98) | def __init__(self, max_dataset_size: int = -1, return_gt: bool = False... class COCO (line 110) | class COCO(datasets.GeneratorBasedBuilder): method _info (line 123) | def _info(self): method _split_generators (line 132) | def _split_generators(self, dl_manager: datasets.download.DownloadMana... method _generate_examples (line 152) | def _generate_examples( FILE: deepcompressor/app/diffusion/dataset/data/DCI/DCI.py class DCIConfig (line 34) | class DCIConfig(datasets.BuilderConfig): method __init__ (line 35) | def __init__(self, max_dataset_size: int = -1, return_gt: bool = False... class DCI (line 47) | class DCI(datasets.GeneratorBasedBuilder): method _info (line 54) | def _info(self): method _split_generators (line 70) | def _split_generators(self, dl_manager: datasets.download.DownloadMana... method _generate_examples (line 83) | def _generate_examples(self, meta_path: str, image_root: str): FILE: deepcompressor/app/diffusion/dataset/data/MJHQ/MJHQ.py class MJHQConfig (line 36) | class MJHQConfig(datasets.BuilderConfig): method __init__ (line 37) | def __init__(self, max_dataset_size: int = -1, return_gt: bool = False... class DCI (line 49) | class DCI(datasets.GeneratorBasedBuilder): method _info (line 56) | def _info(self): method _split_generators (line 73) | def _split_generators(self, dl_manager: datasets.download.DownloadMana... method _generate_examples (line 82) | def _generate_examples(self, meta_path: str, image_root: str): FILE: deepcompressor/app/diffusion/dataset/data/__init__.py function load_dataset_yaml (line 10) | def load_dataset_yaml(meta_path: str, max_dataset_size: int = -1, repeat... function get_dataset (line 30) | def get_dataset( FILE: deepcompressor/app/diffusion/eval/config.py class DiffusionEvalConfig (line 29) | class DiffusionEvalConfig: method __post_init__ (line 103) | def __post_init__(self): method get_pipeline_kwargs (line 110) | def get_pipeline_kwargs(self) -> dict[str, tp.Any]: method _generate (line 124) | def _generate( method generate (line 190) | def generate( method evaluate (line 232) | def evaluate( FILE: deepcompressor/app/diffusion/eval/metrics/__init__.py function compute_image_metrics (line 16) | def compute_image_metrics( function categorize_metrics (line 80) | def categorize_metrics(metrics: tuple[str, ...]) -> tuple[list[str], lis... FILE: deepcompressor/app/diffusion/eval/metrics/fid.py function get_dataset_features (line 15) | def get_dataset_features( function get_fid_features (line 44) | def get_fid_features( function compute_fid (line 87) | def compute_fid( FILE: deepcompressor/app/diffusion/eval/metrics/image_reward.py function compute_image_reward (line 10) | def compute_image_reward( FILE: deepcompressor/app/diffusion/eval/metrics/multimodal.py class PromptImageDataset (line 16) | class PromptImageDataset(data.Dataset): method __init__ (line 17) | def __init__(self, ref_dataset: datasets.Dataset, gen_dirpath: str): method __len__ (line 22) | def __len__(self): method __getitem__ (line 25) | def __getitem__(self, idx: int): function compute_image_multimodal_metrics (line 33) | def compute_image_multimodal_metrics( FILE: deepcompressor/app/diffusion/eval/metrics/similarity.py class MultiImageDataset (line 19) | class MultiImageDataset(data.Dataset): method __init__ (line 20) | def __init__(self, gen_dirpath: str, ref_dirpath_or_dataset: str | dat... method __len__ (line 37) | def __len__(self): method __getitem__ (line 40) | def __getitem__(self, idx: int): function compute_image_similarity_metrics (line 59) | def compute_image_similarity_metrics( FILE: deepcompressor/app/diffusion/nn/attention.py function apply_flux_rope (line 24) | def apply_flux_rope(query, key, image_rotary_emb): class DiffusionAttentionProcessor (line 33) | class DiffusionAttentionProcessor(nn.Module): method __init__ (line 34) | def __init__( method __call__ (line 49) | def __call__( # noqa: C901 FILE: deepcompressor/app/diffusion/nn/patch.py function replace_up_block_conv_with_concat_conv (line 20) | def replace_up_block_conv_with_concat_conv(model: nn.Module) -> None: function replace_fused_linear_with_concat_linear (line 57) | def replace_fused_linear_with_concat_linear(model: nn.Module) -> None: function shift_input_activations (line 73) | def shift_input_activations(model: nn.Module) -> None: function replace_attn_processor (line 109) | def replace_attn_processor(model: nn.Module) -> None: FILE: deepcompressor/app/diffusion/nn/struct.py class DiffusionModuleStruct (line 120) | class DiffusionModuleStruct(BaseModuleStruct): method named_key_modules (line 121) | def named_key_modules(self) -> tp.Generator[tuple[str, str, nn.Module,... class DiffusionBlockStruct (line 133) | class DiffusionBlockStruct(BaseModuleStruct): method iter_attention_structs (line 135) | def iter_attention_structs(self) -> tp.Generator["DiffusionAttentionSt... method iter_transformer_block_structs (line 138) | def iter_transformer_block_structs(self) -> tp.Generator["DiffusionTra... class DiffusionModelStruct (line 142) | class DiffusionModelStruct(DiffusionBlockStruct): method num_blocks (line 148) | def num_blocks(self) -> int: ... method block_structs (line 152) | def block_structs(self) -> list[DiffusionBlockStruct]: ... method get_prev_module_keys (line 155) | def get_prev_module_keys(self) -> tuple[str, ...]: ... method get_post_module_keys (line 158) | def get_post_module_keys(self) -> tuple[str, ...]: ... method _get_iter_block_activations_args (line 161) | def _get_iter_block_activations_args( method _get_iter_pre_module_activations_args (line 165) | def _get_iter_pre_module_activations_args( method _get_iter_post_module_activations_args (line 176) | def _get_iter_post_module_activations_args( method get_iter_layer_activations_args (line 187) | def get_iter_layer_activations_args( method named_key_modules (line 219) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method iter_attention_structs (line 227) | def iter_attention_structs(self) -> tp.Generator["AttentionStruct", No... method iter_transformer_block_structs (line 231) | def iter_transformer_block_structs(self) -> tp.Generator["DiffusionTra... method get_named_layers (line 235) | def get_named_layers( method _default_construct (line 249) | def _default_construct( method _get_default_key_map (line 270) | def _get_default_key_map(cls) -> dict[str, set[str]]: method _simplify_keys (line 284) | def _simplify_keys(keys: tp.Iterable[str], *, key_map: dict[str, set[s... class DiffusionAttentionStruct (line 314) | class DiffusionAttentionStruct(AttentionStruct): method filter_kwargs (line 319) | def filter_kwargs(self, kwargs: dict) -> dict: method _default_construct (line 336) | def _default_construct( class DiffusionFeedForwardStruct (line 422) | class DiffusionFeedForwardStruct(FeedForwardStruct): method up_proj (line 438) | def up_proj(self) -> nn.Linear: method down_proj (line 442) | def down_proj(self) -> nn.Linear: method up_proj_rname (line 446) | def up_proj_rname(self) -> str: method down_proj_rname (line 450) | def down_proj_rname(self) -> str: method up_proj_name (line 454) | def up_proj_name(self) -> str: method down_proj_name (line 458) | def down_proj_name(self) -> str: method __post_init__ (line 463) | def __post_init__(self) -> None: method _default_construct (line 470) | def _default_construct( class DiffusionTransformerBlockStruct (line 540) | class DiffusionTransformerBlockStruct(TransformerBlockStruct, DiffusionB... method __post_init__ (line 579) | def __post_init__(self) -> None: method named_key_modules (line 608) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method _default_construct (line 629) | def _default_construct( method _get_default_key_map (line 737) | def _get_default_key_map(cls) -> dict[str, set[str]]: class DiffusionTransformerStruct (line 779) | class DiffusionTransformerStruct(BaseTransformerStruct, DiffusionBlockSt... method num_blocks (line 814) | def num_blocks(self) -> int: method block_structs (line 818) | def block_structs(self) -> list[DiffusionBlockStruct]: method block_names (line 822) | def block_names(self) -> list[str]: method __post_init__ (line 827) | def __post_init__(self): method _default_construct (line 847) | def _default_construct( method _get_default_key_map (line 886) | def _get_default_key_map(cls) -> dict[str, set[str]]: class DiffusionResnetStruct (line 905) | class DiffusionResnetStruct(BaseModuleStruct): method __post_init__ (line 939) | def __post_init__(self): method named_key_modules (line 949) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method construct (line 959) | def construct( method _get_default_key_map (line 1044) | def _get_default_key_map(cls) -> dict[str, set[str]]: class UNetBlockStruct (line 1057) | class UNetBlockStruct(DiffusionBlockStruct): class BlockType (line 1058) | class BlockType(enum.StrEnum): method downsample (line 1101) | def downsample(self) -> nn.Conv2d | None: method upsample (line 1105) | def upsample(self) -> nn.Conv2d | None: method __post_init__ (line 1108) | def __post_init__(self) -> None: method is_downsample_block (line 1145) | def is_downsample_block(self) -> bool: method is_mid_block (line 1148) | def is_mid_block(self) -> bool: method is_upsample_block (line 1151) | def is_upsample_block(self) -> bool: method has_downsample (line 1154) | def has_downsample(self) -> bool: method has_upsample (line 1157) | def has_upsample(self) -> bool: method named_key_modules (line 1160) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method iter_attention_structs (line 1168) | def iter_attention_structs(self) -> tp.Generator[DiffusionAttentionStr... method iter_transformer_block_structs (line 1172) | def iter_transformer_block_structs(self) -> tp.Generator[DiffusionTran... method _default_construct (line 1177) | def _default_construct( method _get_default_key_map (line 1242) | def _get_default_key_map(cls) -> dict[str, set[str]]: class UNetStruct (line 1267) | class UNetStruct(DiffusionModelStruct): method num_down_blocks (line 1353) | def num_down_blocks(self) -> int: method num_up_blocks (line 1357) | def num_up_blocks(self) -> int: method num_blocks (line 1361) | def num_blocks(self) -> int: method block_structs (line 1365) | def block_structs(self) -> list[UNetBlockStruct]: method __post_init__ (line 1368) | def __post_init__(self) -> None: method get_prev_module_keys (line 1418) | def get_prev_module_keys(self) -> tuple[str, ...]: method get_post_module_keys (line 1421) | def get_post_module_keys(self) -> tuple[str, ...]: method _get_iter_block_activations_args (line 1424) | def _get_iter_block_activations_args( method _default_construct (line 1464) | def _default_construct( method _get_default_key_map (line 1519) | def _get_default_key_map(cls) -> dict[str, set[str]]: class DiTStruct (line 1568) | class DiTStruct(DiffusionModelStruct, DiffusionTransformerStruct): method num_blocks (line 1618) | def num_blocks(self) -> int: method block_structs (line 1622) | def block_structs(self) -> list[DiffusionTransformerBlockStruct]: method block_names (line 1626) | def block_names(self) -> list[str]: method __post_init__ (line 1629) | def __post_init__(self) -> None: method get_prev_module_keys (line 1654) | def get_prev_module_keys(self) -> tuple[str, ...]: method get_post_module_keys (line 1657) | def get_post_module_keys(self) -> tuple[str, ...]: method _get_iter_block_activations_args (line 1660) | def _get_iter_block_activations_args( method _default_construct (line 1685) | def _default_construct( method _get_default_key_map (line 1748) | def _get_default_key_map(cls) -> dict[str, set[str]]: class FluxStruct (line 1789) | class FluxStruct(DiTStruct): method num_blocks (line 1817) | def num_blocks(self) -> int: method block_structs (line 1821) | def block_structs(self) -> list[DiffusionTransformerBlockStruct]: method block_names (line 1825) | def block_names(self) -> list[str]: method __post_init__ (line 1828) | def __post_init__(self) -> None: method _get_iter_block_activations_args (line 1849) | def _get_iter_block_activations_args( method _default_construct (line 1861) | def _default_construct( method _get_default_key_map (line 1906) | def _get_default_key_map(cls) -> dict[str, set[str]]: FILE: deepcompressor/app/diffusion/pipeline/config.py class LoRAConfig (line 38) | class LoRAConfig: class DiffusionPipelineConfig (line 57) | class DiffusionPipelineConfig: method __post_init__ (line 95) | def __post_init__(self): method build (line 105) | def build( method extract_text_encoders (line 129) | def extract_text_encoders( method register_pipeline_factory (line 148) | def register_pipeline_factory( method register_text_extractor (line 174) | def register_text_extractor( method load_lora (line 202) | def load_lora( # noqa: C901 method _default_build (line 327) | def _default_build( method _default_extract_text_encoders (line 371) | def _default_extract_text_encoders( FILE: deepcompressor/app/diffusion/ptq.py function ptq (line 27) | def ptq( # noqa: C901 function main (line 272) | def main(config: DiffusionPtqRunConfig, logging_level: int = tools.loggi... FILE: deepcompressor/app/diffusion/quant/activation.py function quantize_diffusion_block_activations (line 30) | def quantize_diffusion_block_activations( # noqa: C901 function quantize_diffusion_activations (line 193) | def quantize_diffusion_activations( FILE: deepcompressor/app/diffusion/quant/config.py class DiffusionQuantConfig (line 30) | class DiffusionQuantConfig(DiffusionModuleQuantizerConfig): method __post_init__ (line 53) | def __post_init__(self) -> None: # noqa: C901 method enabled_rotation (line 81) | def enabled_rotation(self) -> bool: method enabled_smooth (line 86) | def enabled_smooth(self) -> bool: method enabled_smooth_proj (line 91) | def enabled_smooth_proj(self) -> bool: method enabled_smooth_attn (line 96) | def enabled_smooth_attn(self) -> bool: method needs_acts_quantizer_cache (line 101) | def needs_acts_quantizer_cache(self) -> bool: method generate_calib_dirname (line 109) | def generate_calib_dirname(self) -> str: method generate_cache_dirpath (line 126) | def generate_cache_dirpath( method generate_default_dirname (line 165) | def generate_default_dirname(self) -> str: # noqa: C901 method set_key_map (line 415) | def set_key_map(cls, key_map: dict[str, set[str]]) -> None: method organize (line 423) | def organize(self) -> dict[str, bool]: # noqa: C901 FILE: deepcompressor/app/diffusion/quant/quantizer/config.py class DiffusionGPTQConfig (line 25) | class DiffusionGPTQConfig(SkipBasedConfig, QuantGptqConfig): class DiffusionQuantizerConfig (line 45) | class DiffusionQuantizerConfig(QuantizerConfig): method __post_init__ (line 72) | def __post_init__(self) -> None: method enabled_gptq (line 87) | def enabled_gptq(self) -> bool: method enabled_low_rank (line 92) | def enabled_low_rank(self) -> bool: method enabled_calib_range (line 97) | def enabled_calib_range(self) -> bool: method generate_calib_dirname (line 101) | def generate_calib_dirname(self) -> str: class SkipBasedDiffusionQuantizerConfig (line 121) | class SkipBasedDiffusionQuantizerConfig(SkipBasedConfig, DiffusionQuanti... method __post_init__ (line 145) | def __post_init__(self) -> None: class DiffusionWeightQuantizerConfig (line 153) | class DiffusionWeightQuantizerConfig(SkipBasedDiffusionQuantizerConfig): method needs_calib_data (line 176) | def needs_calib_data(self) -> bool: class DiffusionActivationQuantizerConfig (line 182) | class DiffusionActivationQuantizerConfig(SkipBasedDiffusionQuantizerConf... method needs_calib_data (line 209) | def needs_calib_data(self) -> bool: method generate_dirnames (line 212) | def generate_dirnames( method for_unsigned (line 243) | def for_unsigned(self) -> "DiffusionActivationQuantizerConfig": class DiffusionExtraWeightQuantizerConfig (line 267) | class DiffusionExtraWeightQuantizerConfig(IncludeBasedConfig, DiffusionQ... method needs_calib_data (line 293) | def needs_calib_data(self) -> bool: class DiffusionModuleQuantizerConfig (line 299) | class DiffusionModuleQuantizerConfig(EnableConfig): method is_enabled (line 317) | def is_enabled(self): method enabled_wgts (line 321) | def enabled_wgts(self) -> bool: method enabled_ipts (line 326) | def enabled_ipts(self) -> bool: method enabled_opts (line 331) | def enabled_opts(self) -> bool: method enabled_extra_wgts (line 336) | def enabled_extra_wgts(self) -> bool: method __post_init__ (line 340) | def __post_init__(self) -> None: method generate_dirnames (line 354) | def generate_dirnames( method generate_calib_dirname (line 394) | def generate_calib_dirname(self) -> str: FILE: deepcompressor/app/diffusion/quant/quantizer/quantizer.py class DiffusionQuantizer (line 29) | class DiffusionQuantizer(Quantizer): method __post_init__ (line 73) | def __post_init__(self) -> None: method calibrate_dynamic_range (line 77) | def calibrate_dynamic_range( class DiffusionWeightQuantizer (line 144) | class DiffusionWeightQuantizer(DiffusionQuantizer): method calibrate_dynamic_range (line 185) | def calibrate_dynamic_range( method calibrate_low_rank (line 234) | def calibrate_low_rank( class DiffusionActivationQuantizer (line 267) | class DiffusionActivationQuantizer(DiffusionQuantizer): method __post_init__ (line 304) | def __post_init__(self) -> None: FILE: deepcompressor/app/diffusion/quant/rotate.py function rotate_diffusion (line 23) | def rotate_diffusion( # noqa: C901 FILE: deepcompressor/app/diffusion/quant/smooth.py function smooth_diffusion_attention (line 30) | def smooth_diffusion_attention( function smooth_diffusion_qkv_proj (line 46) | def smooth_diffusion_qkv_proj( function smooth_diffusion_out_proj (line 135) | def smooth_diffusion_out_proj( # noqa: C901 function smooth_diffusion_up_proj (line 236) | def smooth_diffusion_up_proj( function smooth_diffusion_down_proj (line 280) | def smooth_diffusion_down_proj( function smooth_diffusion_parallel_qkv_up_proj (line 317) | def smooth_diffusion_parallel_qkv_up_proj( function smooth_diffusion_sequential_transformer_block (line 404) | def smooth_diffusion_sequential_transformer_block( function smooth_diffusion_parallel_transformer_block (line 448) | def smooth_diffusion_parallel_transformer_block( function smooth_diffusion_module (line 487) | def smooth_diffusion_module( function smooth_diffusion_layer (line 529) | def smooth_diffusion_layer( function smooth_diffusion (line 601) | def smooth_diffusion( FILE: deepcompressor/app/diffusion/quant/utils.py function wrap_joint_attn (line 12) | def wrap_joint_attn(attn: nn.Module, /, *, indexes: int | tuple[int, ...... function get_needs_inputs_fn (line 28) | def get_needs_inputs_fn( function get_needs_outputs_fn (line 82) | def get_needs_outputs_fn( FILE: deepcompressor/app/diffusion/quant/weight.py function calibrate_diffusion_block_low_rank_branch (line 25) | def calibrate_diffusion_block_low_rank_branch( # noqa: C901 function update_diffusion_block_weight_quantizer_state_dict (line 151) | def update_diffusion_block_weight_quantizer_state_dict( function quantize_diffusion_block_weights (line 217) | def quantize_diffusion_block_weights( function quantize_diffusion_weights (line 296) | def quantize_diffusion_weights( function load_diffusion_weights_state_dict (line 436) | def load_diffusion_weights_state_dict( FILE: deepcompressor/app/diffusion/utils.py function update_mask (line 13) | def update_mask(mask: np.ndarray, x: int, y: int, radius: int | float): function generate_mask (line 23) | def generate_mask( function center_crop_and_resize (line 46) | def center_crop_and_resize(image: Image.Image, target_size: int | tuple[... function get_control (line 70) | def get_control( # noqa: C901 FILE: deepcompressor/app/llm/cache/config.py class LlmQuantCacheConfig (line 15) | class LlmQuantCacheConfig(BasePathConfig): class LlmCacheConfig (line 40) | class LlmCacheConfig: FILE: deepcompressor/app/llm/config.py class LlmPtqRunConfig (line 33) | class LlmPtqRunConfig: method __post_init__ (line 70) | def __post_init__(self): # noqa: C901 method get_parser (line 119) | def get_parser(cls) -> ConfigParser: FILE: deepcompressor/app/llm/eval/base.py class LlmEvaluatorBase (line 11) | class LlmEvaluatorBase(ABC): method __init__ (line 12) | def __init__(self, model: PreTrainedModel, tokenizer: PreTrainedTokeni... method filter_tasks (line 16) | def filter_tasks(self, tasks: list[str]) -> list[str]: method evaluate (line 21) | def evaluate(self, tasks: list[str], **kwargs) -> dict[str, dict[str, ... FILE: deepcompressor/app/llm/eval/config.py class LlmEvalConfig (line 25) | class LlmEvalConfig: method __post_init__ (line 62) | def __post_init__(self): method evaluate (line 74) | def evaluate( method make_table (line 171) | def make_table(rst: dict[str, dict[tp.Any, dict[str, tp.Any]]]) -> str: function get_max_seq_length (line 207) | def get_max_seq_length(model: PreTrainedModel, tokenizer: PreTrainedToke... FILE: deepcompressor/app/llm/eval/custom.py class LlmCustomEvaluator (line 17) | class LlmCustomEvaluator(LlmEvaluatorBase): method filter_tasks (line 18) | def filter_tasks(self, tasks: list[str]) -> list[str]: method evaluate (line 22) | def evaluate( function _eval_ppl_with_gptq_evaluator (line 45) | def _eval_ppl_with_gptq_evaluator( FILE: deepcompressor/app/llm/eval/lm_eval.py class LmevalEvaluator (line 13) | class LmevalEvaluator(LlmEvaluatorBase): method __init__ (line 14) | def __init__(self, model: PreTrainedModel, tokenizer: PreTrainedTokeni... method filter_tasks (line 18) | def filter_tasks(self, tasks: list[str]) -> list[str]: method evaluate (line 22) | def evaluate( FILE: deepcompressor/app/llm/eval/longbench/eval.py class LongbenchEvaluator (line 33) | class LongbenchEvaluator(LlmEvaluatorBase): method __init__ (line 60) | def __init__( method filter_tasks (line 80) | def filter_tasks(self, tasks: list[str]) -> list[str]: method evaluate (line 88) | def evaluate(self, tasks: list[str], max_length: int, **kwargs) -> dic... method predict (line 161) | def predict( method build_chat (line 218) | def build_chat(self, prompt): method post_process (line 224) | def post_process(self, response: str) -> str: class LongbenchScorer (line 242) | class LongbenchScorer: method score (line 268) | def score( method scorer_e (line 307) | def scorer_e( FILE: deepcompressor/app/llm/eval/longbench/metrics.py function normalize_answer (line 24) | def normalize_answer(s: str) -> str: function normalize_zh_answer (line 40) | def normalize_zh_answer(s: str) -> str: function count_score (line 56) | def count_score(prediction: str, ground_truth: str, **kwargs) -> float: function retrieval_score (line 66) | def retrieval_score(prediction: str, ground_truth: str, **kwargs) -> float: function retrieval_zh_score (line 78) | def retrieval_zh_score(prediction: str, ground_truth: str, **kwargs) -> ... function code_sim_score (line 90) | def code_sim_score(prediction: str, ground_truth: str, **kwargs) -> float: function classification_score (line 100) | def classification_score(prediction: str, ground_truth: str, **kwargs) -... function rouge_score (line 109) | def rouge_score(prediction: str, ground_truth: str, **kwargs) -> float: function rouge_zh_score (line 117) | def rouge_zh_score(prediction: str, ground_truth: str, **kwargs) -> float: function f1_score (line 123) | def f1_score(prediction: str, ground_truth: str, **kwargs) -> float: function qa_f1_score (line 133) | def qa_f1_score(prediction: str, ground_truth: str, **kwargs) -> float: function qa_f1_zh_score (line 141) | def qa_f1_zh_score(prediction: str, ground_truth: str, **kwargs) -> float: FILE: deepcompressor/app/llm/model/config.py class LlmModelConfig (line 21) | class LlmModelConfig(BaseModelConfig): method __post_init__ (line 56) | def __post_init__(self): method build (line 103) | def build(self) -> tuple[PreTrainedModel, PreTrainedTokenizer]: method _default_build (line 125) | def _default_build(path: str, **kwargs) -> tuple[PreTrainedModel, PreT... method register_model_factory (line 149) | def register_model_factory( FILE: deepcompressor/app/llm/nn/patch.py function rotate_half (line 17) | def rotate_half(x): function update_rotary_cos_sin (line 24) | def update_rotary_cos_sin( class RotaryEmbedding (line 59) | class RotaryEmbedding(nn.Module): method __init__ (line 62) | def __init__(self) -> None: method forward (line 66) | def forward( function apply_rotary_pos_emb (line 90) | def apply_rotary_pos_emb( function patch_attention (line 140) | def patch_attention(model: nn.Module) -> nn.Module: function gemma_rms_norm_forward (line 176) | def gemma_rms_norm_forward(self: GemmaRMSNorm | Gemma2RMSNorm, x: torch.... function patch_gemma_rms_norm (line 186) | def patch_gemma_rms_norm(model: nn.Module) -> nn.Module: FILE: deepcompressor/app/llm/nn/struct.py class LlmTransformerBlockConfigStruct (line 115) | class LlmTransformerBlockConfigStruct(FeedForwardConfigStruct, Attention... class LlmTransformerConfigStruct (line 151) | class LlmTransformerConfigStruct(LlmTransformerBlockConfigStruct): class LlmConfigStruct (line 192) | class LlmConfigStruct(LlmTransformerConfigStruct): class LlmSelfAttentionStruct (line 234) | class LlmSelfAttentionStruct(SelfAttentionStruct): method filter_kwargs (line 246) | def filter_kwargs(self, kwargs: dict) -> dict: method _default_construct (line 251) | def _default_construct( class LlmFeedForwardStruct (line 345) | class LlmFeedForwardStruct(FeedForwardStruct): method _default_construct (line 351) | def _default_construct( class LlmTransformerBlockStruct (line 449) | class LlmTransformerBlockStruct(TransformerBlockStruct): method pre_attn_norm (line 487) | def pre_attn_norm(self) -> nn.LayerNorm | None: method attn (line 491) | def attn(self) -> nn.Module: method post_attn_norm (line 495) | def post_attn_norm(self) -> nn.LayerNorm | None: method pre_attn_norm_rname (line 499) | def pre_attn_norm_rname(self) -> str: method attn_rname (line 503) | def attn_rname(self) -> str: method post_attn_norm_rname (line 507) | def post_attn_norm_rname(self) -> str: method pre_attn_norm_name (line 511) | def pre_attn_norm_name(self) -> str: method attn_name (line 515) | def attn_name(self) -> str: method post_attn_norm_name (line 519) | def post_attn_norm_name(self) -> str: method attn_struct (line 523) | def attn_struct(self) -> LlmSelfAttentionStruct: method __post_init__ (line 528) | def __post_init__(self): method _default_construct (line 545) | def _default_construct( class LlmTransformerStruct (line 613) | class LlmTransformerStruct(BaseTransformerStruct): method num_blocks (line 651) | def num_blocks(self) -> int: method block_structs (line 656) | def block_structs(self) -> list[LlmTransformerBlockStruct]: method block_names (line 660) | def block_names(self) -> list[str]: method __post_init__ (line 666) | def __post_init__(self) -> None: method get_iter_layer_activations_args (line 702) | def get_iter_layer_activations_args( method _default_construct (line 721) | def _default_construct( class LlmModelStruct (line 778) | class LlmModelStruct(BaseModuleStruct): method __post_init__ (line 808) | def __post_init__(self) -> None: method named_key_modules (line 820) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method iter_attention_structs (line 825) | def iter_attention_structs(self) -> tp.Generator[LlmSelfAttentionStruc... method iter_transformer_block_structs (line 828) | def iter_transformer_block_structs(self) -> tp.Generator[LlmTransforme... method get_iter_layer_activations_args (line 831) | def get_iter_layer_activations_args( method _default_construct (line 850) | def _default_construct( FILE: deepcompressor/app/llm/ptq.py function ptq (line 22) | def ptq( # noqa: C901 function main (line 318) | def main(config: LlmPtqRunConfig, logging_level: int = tools.logging.DEB... FILE: deepcompressor/app/llm/quant/activation.py function quantize_llm_layer_activations (line 25) | def quantize_llm_layer_activations( # noqa: C901 function quantize_llm_activations (line 196) | def quantize_llm_activations( FILE: deepcompressor/app/llm/quant/config.py class LlmQuantConfig (line 31) | class LlmQuantConfig(LlmModuleQuantizerConfig): method __post_init__ (line 59) | def __post_init__(self) -> None: # noqa: C901 method enabled_smooth (line 95) | def enabled_smooth(self) -> bool: method enabled_smooth_proj (line 100) | def enabled_smooth_proj(self) -> bool: method enabled_smooth_attn (line 105) | def enabled_smooth_attn(self) -> bool: method enabled_reorder (line 110) | def enabled_reorder(self) -> bool: method enabled_rotation (line 115) | def enabled_rotation(self) -> bool: method needs_acts_quantizer_cache (line 120) | def needs_acts_quantizer_cache(self) -> bool: method generate_calib_dirname (line 128) | def generate_calib_dirname(self) -> str: method generate_default_dirname (line 149) | def generate_default_dirname(self) -> str: # noqa: C901 method generate_cache_dirpath (line 329) | def generate_cache_dirpath( FILE: deepcompressor/app/llm/quant/dataset.py class LlmCalibDataLoaderConfig (line 33) | class LlmCalibDataLoaderConfig(BaseDataLoaderConfig): method __post_init__ (line 60) | def __post_init__(self) -> None: method generate_dirnames (line 68) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: method build_dataset (line 73) | def build_dataset(self, tokenizer: PreTrainedTokenizer) -> "LlmCalibDa... method build_loader (line 94) | def build_loader(self, tokenizer: PreTrainedTokenizer) -> "LlmCalibCac... class LlmCalibDataset (line 108) | class LlmCalibDataset(torch.utils.data.Dataset): method __init__ (line 111) | def __init__( method __len__ (line 158) | def __len__(self) -> int: method __getitem__ (line 161) | def __getitem__(self, idx: int) -> torch.Tensor: class LlmCalibCacheLoader (line 165) | class LlmCalibCacheLoader(BaseCalibCacheLoader): method __init__ (line 171) | def __init__(self, config: LlmCalibDataLoaderConfig, tokenizer: PreTra... method _init_cache (line 184) | def _init_cache(self, name: str, module: nn.Module) -> IOTensorsCache: method _convert_layer_inputs (line 207) | def _convert_layer_inputs( method iter_samples (line 231) | def iter_samples(self) -> tp.Generator[ModuleForwardInput, None, None]: method iter_layer_activations (line 248) | def iter_layer_activations( # noqa: C901 FILE: deepcompressor/app/llm/quant/quantizer/config.py class LlmQuantizerConfig (line 21) | class LlmQuantizerConfig(SkipBasedConfig, ProgressiveQuantizerConfig): method __post_init__ (line 53) | def __post_init__(self) -> None: method enabled_gptq (line 63) | def enabled_gptq(self) -> bool: method enabled_calib_range (line 68) | def enabled_calib_range(self) -> bool: method needs_calib_data (line 73) | def needs_calib_data(self) -> bool: method generate_calib_dirname (line 76) | def generate_calib_dirname(self) -> str: class LlmWeightQuantizerConfig (line 94) | class LlmWeightQuantizerConfig(LlmQuantizerConfig): class LlmActivationQuantizerConfig (line 125) | class LlmActivationQuantizerConfig(LlmQuantizerConfig): class LlmModuleQuantizerConfig (line 153) | class LlmModuleQuantizerConfig(EnableConfig): method is_enabled (line 169) | def is_enabled(self) -> bool: method enabled_wgts (line 174) | def enabled_wgts(self) -> bool: method enabled_ipts (line 179) | def enabled_ipts(self) -> bool: method enabled_opts (line 184) | def enabled_opts(self) -> bool: method generate_dirnames (line 188) | def generate_dirnames( method generate_calib_dirname (line 225) | def generate_calib_dirname(self) -> str: FILE: deepcompressor/app/llm/quant/quantizer/quantizer.py class LlmQuantizer (line 23) | class LlmQuantizer(Quantizer): method __post_init__ (line 62) | def __post_init__(self) -> None: method calibrate_dynamic_range (line 65) | def calibrate_dynamic_range( class LlmWeightQuantizer (line 132) | class LlmWeightQuantizer(LlmQuantizer): method calibrate_dynamic_range (line 167) | def calibrate_dynamic_range( class LlmActivationQuantizer (line 218) | class LlmActivationQuantizer(LlmQuantizer): method __post_init__ (line 256) | def __post_init__(self) -> None: FILE: deepcompressor/app/llm/quant/reorder.py function _extend_params_ (line 25) | def _extend_params_( function reorder_llm_layer (line 49) | def reorder_llm_layer( # noqa: C901 function reorder_llm (line 240) | def reorder_llm( # noqa: C901 FILE: deepcompressor/app/llm/quant/rotate.py function rotate_llm (line 26) | def rotate_llm( # noqa: C901 FILE: deepcompressor/app/llm/quant/smooth.py function smooth_llm_layer (line 24) | def smooth_llm_layer( # noqa: C901 function smooth_llm (line 171) | def smooth_llm( FILE: deepcompressor/app/llm/quant/utils.py function get_needs_inputs_fn (line 14) | def get_needs_inputs_fn(model: LlmModelStruct, config: LlmModuleQuantize... function get_needs_outputs_fn (line 61) | def get_needs_outputs_fn( FILE: deepcompressor/app/llm/quant/weight.py function quantize_llm_layer_weights (line 25) | def quantize_llm_layer_weights( # noqa: C901 function quantize_llm_weights (line 109) | def quantize_llm_weights( FILE: deepcompressor/backend/nunchaku/convert.py function convert_to_nunchaku_w4x4y16_linear_state_dict (line 13) | def convert_to_nunchaku_w4x4y16_linear_state_dict( function convert_to_nunchaku_w4x16_adanorm_single_state_dict (line 75) | def convert_to_nunchaku_w4x16_adanorm_single_state_dict( function convert_to_nunchaku_w4x16_adanorm_zero_state_dict (line 92) | def convert_to_nunchaku_w4x16_adanorm_zero_state_dict( function update_state_dict (line 109) | def update_state_dict( function convert_to_nunchaku_transformer_block_state_dict (line 119) | def convert_to_nunchaku_transformer_block_state_dict( function convert_to_nunchaku_flux_single_transformer_block_state_dict (line 221) | def convert_to_nunchaku_flux_single_transformer_block_state_dict( function convert_to_nunchaku_flux_transformer_block_state_dict (line 272) | def convert_to_nunchaku_flux_transformer_block_state_dict( function convert_to_nunchaku_flux_state_dicts (line 347) | def convert_to_nunchaku_flux_state_dicts( FILE: deepcompressor/backend/nunchaku/convert_lora.py function reorder_adanorm_lora_up (line 16) | def reorder_adanorm_lora_up(lora_up: torch.Tensor, splits: int) -> torch... function convert_to_nunchaku_transformer_block_lowrank_dict (line 22) | def convert_to_nunchaku_transformer_block_lowrank_dict( # noqa: C901 function convert_to_nunchaku_flux_single_transformer_block_lowrank_dict (line 146) | def convert_to_nunchaku_flux_single_transformer_block_lowrank_dict( function convert_to_nunchaku_flux_transformer_block_lowrank_dict (line 193) | def convert_to_nunchaku_flux_transformer_block_lowrank_dict( function convert_to_nunchaku_flux_lowrank_dict (line 237) | def convert_to_nunchaku_flux_lowrank_dict( FILE: deepcompressor/backend/nunchaku/utils.py class NunchakuWeightPacker (line 16) | class NunchakuWeightPacker(MmaWeightPackerBase): method __init__ (line 17) | def __init__(self, bits: int, warp_n: int = 128): method pack_weight (line 21) | def pack_weight(self, weight: torch.Tensor) -> torch.Tensor: method pack_scale (line 62) | def pack_scale(self, scale: torch.Tensor, group_size: int) -> torch.Te... method pack_micro_scale (line 109) | def pack_micro_scale(self, scale: torch.Tensor, group_size: int) -> to... method pack_lowrank_weight (line 153) | def pack_lowrank_weight(self, weight: torch.Tensor, down: bool) -> tor... method unpack_lowrank_weight (line 184) | def unpack_lowrank_weight(self, weight: torch.Tensor, down: bool) -> t... method check_if_micro_scale (line 216) | def check_if_micro_scale(self, group_size: int) -> bool: method pad_weight (line 219) | def pad_weight(self, weight: torch.Tensor) -> torch.Tensor: method pad_scale (line 223) | def pad_scale(self, scale: torch.Tensor, group_size: int) -> torch.Ten... method pad_lowrank_weight (line 234) | def pad_lowrank_weight(self, weight: torch.Tensor, down: bool) -> torc... function convert_to_nunchaku_w4x4y16_linear_weight (line 239) | def convert_to_nunchaku_w4x4y16_linear_weight( function convert_to_nunchaku_w8x8y16_linear_weight (line 318) | def convert_to_nunchaku_w8x8y16_linear_weight( function convert_to_nunchaku_w4x16_linear_weight (line 341) | def convert_to_nunchaku_w4x16_linear_weight( FILE: deepcompressor/backend/qserve/convert.py function convert_to_qserve_w4x8y16_linear_state_dict (line 15) | def convert_to_qserve_w4x8y16_linear_state_dict( function convert_to_qserve_w8x8y16_linear_state_dict (line 58) | def convert_to_qserve_w8x8y16_linear_state_dict( function convert_to_qserve_state_dict (line 83) | def convert_to_qserve_state_dict( FILE: deepcompressor/backend/qserve/utils.py class QServePacker (line 11) | class QServePacker(MmaWeightPackerBase): method __init__ (line 12) | def __init__(self): method pack_weight (line 18) | def pack_weight(self, weight: torch.Tensor) -> torch.Tensor: method pack_scale (line 46) | def pack_scale( function convert_to_qserve_w4x8y16_linear_weight (line 64) | def convert_to_qserve_w4x8y16_linear_weight( function convert_to_qserve_w8x8y16_linear_weight (line 182) | def convert_to_qserve_w8x8y16_linear_weight( FILE: deepcompressor/backend/tinychat/convert.py function convert_to_tinychat_w4x16y16_linear_state_dict (line 14) | def convert_to_tinychat_w4x16y16_linear_state_dict( function convert_to_tinychat_state_dict (line 50) | def convert_to_tinychat_state_dict( FILE: deepcompressor/backend/tinychat/csrc/pybind.cpp function PYBIND11_MODULE (line 6) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) FILE: deepcompressor/backend/tinychat/csrc/quantization/gemm/semaphore.h function class (line 44) | class Semaphore FILE: deepcompressor/backend/tinychat/linear.py class W4Linear (line 21) | class W4Linear(nn.Module): method __init__ (line 22) | def __init__( method weight_bits (line 71) | def weight_bits(self) -> int: method interleave (line 75) | def interleave(self) -> int: method forward (line 79) | def forward(self, x): method from_linear (line 97) | def from_linear( method extra_repr (line 174) | def extra_repr(self) -> str: FILE: deepcompressor/backend/tinychat/utils.py function ceil_num_groups (line 11) | def ceil_num_groups(in_features: int, group_size: int, weight_bits: int ... function pack_w4 (line 45) | def pack_w4(weight: torch.Tensor) -> torch.Tensor: function convert_to_tinychat_w4x16y16_linear_weight (line 56) | def convert_to_tinychat_w4x16y16_linear_weight( FILE: deepcompressor/backend/utils.py function ceil_divide (line 12) | def ceil_divide(x: int, divisor: int) -> int: function pad (line 28) | def pad( function load_state_dict_in_safetensors (line 55) | def load_state_dict_in_safetensors( function fp_quantize (line 81) | def fp_quantize(x: torch.Tensor, codebook: torch.Tensor | None = None) -... class MmaWeightPackerBase (line 91) | class MmaWeightPackerBase: method __init__ (line 92) | def __init__(self, bits: int, warp_n: int, comp_n: int = None, comp_k:... method get_view_shape (line 143) | def get_view_shape(self, n: int, k: int) -> tuple[int, int, int, int, ... FILE: deepcompressor/calib/config/lowrank.py class QuantLowRankCalibConfig (line 18) | class QuantLowRankCalibConfig(SearchBasedCalibConfig, QuantLowRankConfig): method __post_init__ (line 51) | def __post_init__(self): method generate_dirnames (line 58) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: class SkipBasedQuantLowRankCalibConfig (line 80) | class SkipBasedQuantLowRankCalibConfig(SkipBasedConfig, QuantLowRankCali... FILE: deepcompressor/calib/config/range.py class DynamicRangeCalibConfig (line 17) | class DynamicRangeCalibConfig(SearchBasedCalibConfig): method get_linear_ratios (line 59) | def get_linear_ratios(self) -> list[float]: method get_ratios (line 73) | def get_ratios(self) -> list[list[float]]: method generate_dirnames (line 87) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: class SkipBasedDynamicRangeCalibConfig (line 115) | class SkipBasedDynamicRangeCalibConfig(SkipBasedConfig, DynamicRangeCali... FILE: deepcompressor/calib/config/reorder.py class ChannelOrderCalibConfig (line 22) | class ChannelOrderCalibConfig(SearchBasedCalibConfig): class ChannelMetric (line 46) | class ChannelMetric(enum.Enum): class ChannelIndex (line 59) | class ChannelIndex(enum.Enum): method __post_init__ (line 76) | def __post_init__(self) -> None: method generate_dirnames (line 81) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: class SkipBasedChannelOrderConfig (line 114) | class SkipBasedChannelOrderConfig(SkipBasedConfig, ChannelOrderCalibConf... FILE: deepcompressor/calib/config/rotation.py class QuantRotationConfig (line 16) | class QuantRotationConfig: method __post_init__ (line 36) | def __post_init__(self) -> None: method generate_dirnames (line 45) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: method update_get_arguments (line 57) | def update_get_arguments( method update_from_dict (line 77) | def update_from_dict( FILE: deepcompressor/calib/config/search.py class SearchBasedCalibStrategy (line 19) | class SearchBasedCalibStrategy(enum.Enum): class SearchBasedCalibGranularity (line 30) | class SearchBasedCalibGranularity(enum.Enum): class SearchBasedCalibObjective (line 38) | class SearchBasedCalibObjective(enum.Enum): class SearchBasedCalibConfig (line 51) | class SearchBasedCalibConfig: method __post_init__ (line 88) | def __post_init__(self) -> None: method needs_search (line 106) | def needs_search(self) -> bool: method generate_dirnames (line 110) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: FILE: deepcompressor/calib/config/smooth.py class SmoothSpanMode (line 28) | class SmoothSpanMode(enum.Enum): class SmoothCalibConfig (line 37) | class SmoothCalibConfig(SearchBasedCalibConfig): method __post_init__ (line 98) | def __post_init__(self) -> None: # noqa: C901 method get_alpha_beta_pairs (line 134) | def get_alpha_beta_pairs(self) -> list[tuple[float, float]]: # noqa: ... method generate_dirnames (line 224) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: class SkipBasedSmoothCalibConfig (line 264) | class SkipBasedSmoothCalibConfig(SkipBasedConfig, SmoothCalibConfig): class SmoothAttentionCalibConfig (line 311) | class SmoothAttentionCalibConfig(SmoothCalibConfig): class SmoothTransfomerConfig (line 349) | class SmoothTransfomerConfig: method enabled_proj (line 363) | def enabled_proj(self) -> bool: method enabled_attn (line 368) | def enabled_attn(self) -> bool: method generate_dirnames (line 372) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: FILE: deepcompressor/calib/lowrank.py class QuantLowRankCalibrator (line 20) | class QuantLowRankCalibrator(SearchBasedCalibrator[QuantLowRankCalibConf... method __init__ (line 23) | def __init__( method population_size (line 58) | def population_size(self) -> int: method allows_x_quant_for_wgts (line 63) | def allows_x_quant_for_wgts(self) -> bool: method allows_w_quant_for_wgts (line 68) | def allows_w_quant_for_wgts(self) -> bool: method is_done (line 72) | def is_done(self) -> bool: method is_last_iter (line 76) | def is_last_iter(self) -> bool: method _reset (line 80) | def _reset(self, x_wgts: list[torch.Tensor | nn.Parameter], **kwargs) ... method get_best (line 109) | def get_best(self) -> LowRankBranch: method _ask (line 118) | def _ask(self) -> LowRankBranch: method _tell (line 156) | def _tell(self, error: list[torch.Tensor]) -> None: # noqa: C901 method _process_x_in_xw (line 188) | def _process_x_in_xw(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_w_in_xw (line 193) | def _process_w_in_xw(self, w: torch.Tensor) -> torch.Tensor: method _process_y_in_yx (line 199) | def _process_y_in_yx(self, y: torch.Tensor, channels_dim: int | _MISSI... method _process_x_in_yx (line 202) | def _process_x_in_yx(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_xw_in_yx (line 205) | def _process_xw_in_yx(self, w: torch.Tensor) -> torch.Tensor: method _process_yw_in_yx (line 208) | def _process_yw_in_yx(self, w: torch.Tensor) -> torch.Tensor: method _process_wgts_centric_mod (line 211) | def _process_wgts_centric_mod( FILE: deepcompressor/calib/metric.py class ChannelMetric (line 13) | class ChannelMetric: method _normalize (line 17) | def _normalize( method _abs_max (line 32) | def _abs_max( method _abs_sum (line 49) | def _abs_sum( method _abs_normalize_sum (line 61) | def _abs_normalize_sum( method _square_sum (line 77) | def _square_sum( method _max_reduce (line 89) | def _max_reduce( method _sum_reduce (line 115) | def _sum_reduce( method abs_max (line 142) | def abs_max( method abs_mean (line 155) | def abs_mean( method abs_normalize_mean (line 169) | def abs_normalize_mean( method root_mean_square (line 184) | def root_mean_square( FILE: deepcompressor/calib/range.py class DynamicRangeCalibrator (line 25) | class DynamicRangeCalibrator(SearchBasedCalibrator[DynamicRangeCalibConf... method __init__ (line 28) | def __init__( method population_size (line 65) | def population_size(self) -> int: method is_clamp_based (line 69) | def is_clamp_based(self) -> bool: method _reset (line 73) | def _reset( # noqa: C901 method get_best (line 152) | def get_best(self) -> DynamicRange: method _ask (line 166) | def _ask(self) -> DynamicRange: method _tell (line 183) | def _tell(self, error: list[torch.Tensor]) -> None: # noqa: C901 method _preprocess_with_pre_scale (line 252) | def _preprocess_with_pre_scale(self, t: torch.Tensor) -> torch.Tensor: method _process_wxy (line 260) | def _process_wxy(self, tensor: torch.Tensor, channels_dim: int | _MISS... method _process_x_in_xw (line 277) | def _process_x_in_xw(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_w_in_xw (line 282) | def _process_w_in_xw(self, w: torch.Tensor) -> torch.Tensor: method _process_y_in_yx (line 287) | def _process_y_in_yx(self, y: torch.Tensor, channels_dim: int | _MISSI... method _process_x_in_yx (line 292) | def _process_x_in_yx(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_xw_in_yx (line 295) | def _process_xw_in_yx(self, w: torch.Tensor) -> torch.Tensor: method _process_yw_in_yx (line 298) | def _process_yw_in_yx(self, w: torch.Tensor) -> torch.Tensor: function calibrate_dynamic_range (line 302) | def calibrate_dynamic_range( FILE: deepcompressor/calib/reorder.py class ChannelReorderer (line 29) | class ChannelReorderer(BaseTensorProcessor): method is_enabled (line 39) | def is_enabled(self) -> bool: method get_input_packager (line 42) | def get_input_packager(self) -> BaseInputPackager | None: method get_output_packager (line 45) | def get_output_packager(self) -> BaseOutputPackager | None: method process (line 48) | def process(self, tensor: torch.Tensor) -> torch.Tensor: function get_channel_index_from_rank (line 61) | def get_channel_index_from_rank( function get_channel_metric (line 91) | def get_channel_metric( function update_channel_metric (line 160) | def update_channel_metric( function init_channel_index_from_metric (line 211) | def init_channel_index_from_metric( class ChannelOrderCalibrator (line 268) | class ChannelOrderCalibrator(SearchBasedCalibrator[ChannelOrderCalibConf... method __init__ (line 271) | def __init__( method population_size (line 318) | def population_size(self) -> int: method allows_x_quant_for_wgts (line 324) | def allows_x_quant_for_wgts(self) -> bool: method allows_w_quant_for_wgts (line 329) | def allows_w_quant_for_wgts(self) -> bool: method update_channel_metrics (line 333) | def update_channel_metrics(self, weights: list[torch.Tensor | nn.Param... method init_channel_indexes (line 357) | def init_channel_indexes(self) -> None: method _reset (line 389) | def _reset(self, x_wgts: list[torch.Tensor | nn.Parameter], x_acts: Te... method get_best (line 405) | def get_best(self) -> torch.Tensor: method _ask (line 413) | def _ask(self) -> torch.Tensor: method _tell (line 427) | def _tell(self, errors: list[tuple[torch.Tensor, ...]]) -> None: # no... method _get_error_str (line 457) | def _get_error_str(self, e: list[int | float]) -> str: method _get_metric_index_mode_str (line 460) | def _get_metric_index_mode_str(self, candidate_id: int) -> str: method _process_x_in_xw (line 472) | def _process_x_in_xw(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_w_in_xw (line 484) | def _process_w_in_xw(self, w: torch.Tensor) -> torch.Tensor: method _process_x_in_yx (line 494) | def _process_x_in_yx(self, x: torch.Tensor, channels_dim: int) -> torc... method _process_y_in_yx (line 497) | def _process_y_in_yx(self, x: torch.Tensor, channels_dim: int) -> torc... method _process_xw_in_yx (line 500) | def _process_xw_in_yx(self, w: torch.Tensor) -> torch.Tensor: method _process_yw_in_yx (line 503) | def _process_yw_in_yx(self, w: torch.Tensor) -> torch.Tensor: method _process_wgts_centric_mod (line 506) | def _process_wgts_centric_mod( method _recover_mod (line 537) | def _recover_mod(self) -> None: FILE: deepcompressor/calib/rotate.py class RMSNorm (line 24) | class RMSNorm(nn.Module): method __init__ (line 27) | def __init__(self, hidden_size: int, eps=1e-6) -> None: method forward (line 33) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: class HadamardTransformHook (line 42) | class HadamardTransformHook(IOHook): method __init__ (line 43) | def __init__( method pre_forward (line 52) | def pre_forward( function rotate_in_channels (line 66) | def rotate_in_channels(weight: nn.Parameter, /, *, rotation: torch.Tenso... function rotate_out_channels (line 76) | def rotate_out_channels(weight: nn.Parameter, /, *, rotation: torch.Tens... function hadamard_in_channels (line 98) | def hadamard_in_channels( function get_rotation_matrix (line 120) | def get_rotation_matrix(num_channels: int, random: bool = True, compatib... function transform_rms_norm_and_linear (line 136) | def transform_rms_norm_and_linear(norm: nn.LayerNorm | RMSNorm, next_mod... function transform_layer_norm_to_rms_norm (line 165) | def transform_layer_norm_to_rms_norm( function transform_norm_and_linear (line 219) | def transform_norm_and_linear( FILE: deepcompressor/calib/search.py function _reshape_w_for_wgts (line 26) | def _reshape_w_for_wgts(w: torch.Tensor, w_view_shape: torch.Size) -> to... function _reshape_x_for_wgts (line 35) | def _reshape_x_for_wgts(x: torch.Tensor, w_view_shape: torch.Size) -> to... function _reshape_x_for_ipts (line 45) | def _reshape_x_for_ipts(x: torch.Tensor, x_view_shape: torch.Size) -> to... function _reshape_w_for_ipts (line 55) | def _reshape_w_for_ipts(w: torch.Tensor, x_view_shape: torch.Size) -> to... class SearchBasedCalibrator (line 63) | class SearchBasedCalibrator(ABC, tp.Generic[_CONFIG, _CANDIDATE]): method __init__ (line 69) | def __init__( method population_size (line 129) | def population_size(self) -> int: method allows_x_quant_for_wgts (line 134) | def allows_x_quant_for_wgts(self) -> bool: method allows_w_quant_for_wgts (line 139) | def allows_w_quant_for_wgts(self) -> bool: method allows_x_quant_for_ipts (line 144) | def allows_x_quant_for_ipts(self) -> bool: method allows_w_quant_for_ipts (line 149) | def allows_w_quant_for_ipts(self) -> bool: method allows_x_quant_for_opts (line 154) | def allows_x_quant_for_opts(self) -> bool: method allows_y_quant_for_opts (line 159) | def allows_y_quant_for_opts(self) -> bool: method allows_w_quant_for_opts (line 164) | def allows_w_quant_for_opts(self) -> bool: method needs_to_pre_reshape_x_for_wgts (line 169) | def needs_to_pre_reshape_x_for_wgts(self) -> bool: method needs_to_pre_reshape_w_for_ipts (line 174) | def needs_to_pre_reshape_w_for_ipts(self) -> bool: method _reset (line 178) | def _reset(self, **kwargs) -> None: method reset (line 181) | def reset(self, **kwargs) -> None: method is_done (line 189) | def is_done(self) -> bool: method is_last_iter (line 193) | def is_last_iter(self) -> bool: method is_last_candidate_in_iter (line 197) | def is_last_candidate_in_iter(self) -> bool: method get_best (line 202) | def get_best(self) -> _CANDIDATE: method _ask (line 212) | def _ask(self) -> _CANDIDATE: method _tell (line 222) | def _tell(self, error: list[torch.Tensor]) -> None: method ask (line 231) | def ask(self) -> _CANDIDATE: method tell (line 241) | def tell(self, error: list[torch.Tensor]) -> None: method _parse_ipts (line 254) | def _parse_ipts(self, ipts: TensorsCache | None, set_device: bool = Fa... method _parse_args (line 287) | def _parse_args( # noqa: C901 method _reshape_w_for_wgts_centric_partial_products (line 435) | def _reshape_w_for_wgts_centric_partial_products(self, w: torch.Tensor... method _reshape_x_for_wgts_centric_partial_products (line 438) | def _reshape_x_for_wgts_centric_partial_products( method _reshape_w_for_ipts_centric_partial_products (line 443) | def _reshape_w_for_ipts_centric_partial_products(self, w: torch.Tensor... method _reshape_x_for_ipts_centric_partial_products (line 446) | def _reshape_x_for_ipts_centric_partial_products( method _reshape_w_for_full_products (line 451) | def _reshape_w_for_full_products(self, w: torch.Tensor, *, view_shape:... method _reshape_x_for_full_products (line 454) | def _reshape_x_for_full_products( method _process_x_in_xw (line 462) | def _process_x_in_xw(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_w_in_xw (line 465) | def _process_w_in_xw(self, w: torch.Tensor) -> torch.Tensor: ... method _process_y_in_yx (line 468) | def _process_y_in_yx(self, y: torch.Tensor, channels_dim: int | _MISSI... method _process_x_in_yx (line 471) | def _process_x_in_yx(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_xw_in_yx (line 474) | def _process_xw_in_yx(self, w: torch.Tensor) -> torch.Tensor: ... method _process_yw_in_yx (line 477) | def _process_yw_in_yx(self, w: torch.Tensor) -> torch.Tensor: ... method _recover_mod (line 479) | def _recover_mod(self) -> None: method _process_wgts_centric_mod (line 487) | def _process_wgts_centric_mod( method _process_ipts_centric_mod (line 498) | def _process_ipts_centric_mod( method _process_opts_centric_mod (line 509) | def _process_opts_centric_mod( method calibrate (line 532) | def calibrate( method _calibrate_wgts (line 678) | def _calibrate_wgts( # noqa: C901 method _calibrate_ipts (line 839) | def _calibrate_ipts( # noqa: C901 method _calibrate_opts (line 996) | def _calibrate_opts( # noqa: C901 FILE: deepcompressor/calib/smooth.py class ActivationSmoother (line 35) | class ActivationSmoother(BaseTensorProcessor): method is_enabled (line 47) | def is_enabled(self) -> bool: method get_input_packager (line 50) | def get_input_packager(self) -> BaseInputPackager | None: method get_output_packager (line 53) | def get_output_packager(self) -> BaseOutputPackager | None: method process (line 56) | def process(self, tensor: torch.Tensor) -> torch.Tensor: function get_smooth_span (line 82) | def get_smooth_span( function get_smooth_scale (line 117) | def get_smooth_scale(*, alpha_base: torch.Tensor, beta_base: torch.Tenso... class SmoothCalibrator (line 149) | class SmoothCalibrator(SearchBasedCalibrator[SmoothCalibConfig, torch.Te... method __init__ (line 152) | def __init__( method population_size (line 223) | def population_size(self) -> int: method allows_x_quant_for_wgts (line 228) | def allows_x_quant_for_wgts(self) -> bool: method allows_w_quant_for_wgts (line 233) | def allows_w_quant_for_wgts(self) -> bool: method allows_w_quant_for_ipts (line 238) | def allows_w_quant_for_ipts(self) -> bool: method allows_x_quant_for_opts (line 243) | def allows_x_quant_for_opts(self) -> bool: method allows_y_quant_for_opts (line 248) | def allows_y_quant_for_opts(self) -> bool: method allows_w_quant_for_opts (line 253) | def allows_w_quant_for_opts(self) -> bool: method span_mode_pairs (line 258) | def span_mode_pairs(self) -> list[tuple[SmoothSpanMode, SmoothSpanMode]]: method alpha_span_modes (line 263) | def alpha_span_modes(self) -> list[SmoothSpanMode]: method beta_span_modes (line 268) | def beta_span_modes(self) -> list[SmoothSpanMode]: method _reset (line 272) | def _reset( # noqa: C901 method _split_candidate_id (line 388) | def _split_candidate_id(self, candidate_id: int) -> tuple[int, int]: method get_best (line 403) | def get_best(self) -> torch.Tensor: method _ask (line 412) | def _ask(self) -> torch.Tensor: method _tell (line 428) | def _tell(self, error: list[torch.Tensor]) -> None: # noqa: C901 method _reshape_scale (line 495) | def _reshape_scale( method _process_x_in_xw (line 504) | def _process_x_in_xw(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_w_in_xw (line 519) | def _process_w_in_xw(self, w: torch.Tensor) -> torch.Tensor: method _process_x_in_yx (line 532) | def _process_x_in_yx(self, x: torch.Tensor, channels_dim: int | _MISSI... method _process_y_in_yx (line 553) | def _process_y_in_yx(self, y: torch.Tensor, channels_dim: int | _MISSI... method _process_xw_in_yx (line 574) | def _process_xw_in_yx(self, w: torch.Tensor) -> torch.Tensor: method _process_yw_in_yx (line 577) | def _process_yw_in_yx(self, w: torch.Tensor) -> torch.Tensor: method _process_wgts_centric_mod (line 580) | def _process_wgts_centric_mod( method _process_opts_centric_mod (line 627) | def _process_opts_centric_mod( method _update_best (line 656) | def _update_best( class SmoothLinearCalibrator (line 717) | class SmoothLinearCalibrator(SmoothCalibrator): method __init__ (line 720) | def __init__( class SmoothAttentionCalibrator (line 757) | class SmoothAttentionCalibrator(SmoothCalibrator): method __init__ (line 760) | def __init__( method calibrate (line 800) | def calibrate( function smooth_upscale_param (line 852) | def smooth_upscale_param(param: nn.Parameter, scale: torch.Tensor, chann... function smooth_downscale_param (line 872) | def smooth_downscale_param(param: nn.Parameter, scale: torch.Tensor, cha... function convert_smooth_upscale_to_downscale (line 894) | def convert_smooth_upscale_to_downscale( function smooth_linear_modules (line 920) | def smooth_linear_modules( function smooth_attention (line 1019) | def smooth_attention( FILE: deepcompressor/csrc/pybind.cpp function PYBIND11_MODULE (line 6) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: deepcompressor/data/cache.py class ModuleForwardInput (line 18) | class ModuleForwardInput: method to (line 24) | def to(self, device: torch.device | str) -> "ModuleForwardInput": method update (line 40) | def update(self, x: dict[str | int, tp.Any] | None = None) -> "ModuleF... class TensorCache (line 62) | class TensorCache: method clear (line 92) | def clear(self): method get_factory_kwargs (line 97) | def get_factory_kwargs(self, **kwargs) -> dict[str, tp.Any]: method get_standardized_data (line 106) | def get_standardized_data(self, reshape: bool = False) -> list[torch.T... method repartition (line 122) | def repartition(self, max_batch_size: int, max_size: int, standardize:... class TensorsCache (line 181) | class TensorsCache: method __init__ (line 186) | def __init__(self, tensors: OrderedDict[str | int, TensorCache] | Tens... method num_tensors (line 191) | def num_tensors(self) -> int: method front (line 195) | def front(self) -> TensorCache: method items (line 199) | def items(self) -> tp.ItemsView[str | int, TensorCache]: method keys (line 203) | def keys(self) -> tp.KeysView[str | int]: method values (line 207) | def values(self) -> tp.ValuesView[TensorCache]: method __getitem__ (line 211) | def __getitem__(self, key: str | int) -> TensorCache: method __iter__ (line 215) | def __iter__(self) -> tp.Iterator[TensorCache]: method __len__ (line 219) | def __len__(self) -> int: method clear (line 223) | def clear(self): method set_num_samples (line 228) | def set_num_samples(self, num_samples: int): method extract (line 233) | def extract(self, index: int, kwargs: dict[str, tp.Any]) -> ModuleForw... class IOTensorsCache (line 257) | class IOTensorsCache: method __init__ (line 263) | def __init__( method clear (line 269) | def clear(self): method set_num_samples (line 276) | def set_num_samples(self, num_samples: int): FILE: deepcompressor/data/codebook.py class Codebook (line 14) | class Codebook: method __post_init__ (line 33) | def __post_init__(self): method round (line 37) | def round(self, tensor: torch.Tensor) -> torch.Tensor: method to (line 52) | def to(self, *, device: torch.device | None = None, dtype: torch.dtype... method construct (line 75) | def construct( method build_for_float_point (line 112) | def build_for_float_point( method build_for_integer (line 173) | def build_for_integer( FILE: deepcompressor/data/common.py class TensorType (line 9) | class TensorType(enum.Enum): FILE: deepcompressor/data/dtype.py class QuantDataType (line 13) | class QuantDataType: method __init__ (line 18) | def __init__( method name (line 119) | def name(self) -> str: method codebook_name (line 124) | def codebook_name(self) -> str: method signed (line 129) | def signed(self) -> bool: method unsigned (line 134) | def unsigned(self) -> bool: method total_bits (line 139) | def total_bits(self) -> int: method exponent_bits (line 144) | def exponent_bits(self) -> int: method mantissa_bits (line 149) | def mantissa_bits(self) -> int: method has_subnormal (line 154) | def has_subnormal(self) -> bool: method has_inf (line 159) | def has_inf(self) -> bool: method has_nan (line 164) | def has_nan(self) -> bool: method magnitude (line 169) | def magnitude(self) -> bool: method is_float_point (line 174) | def is_float_point(self) -> bool: method is_integer (line 179) | def is_integer(self) -> bool: method is_exponent (line 184) | def is_exponent(self) -> bool: method exponent_mask (line 189) | def exponent_mask(self) -> int: method mantissa_mask (line 194) | def mantissa_mask(self) -> int: method _end_mantissa (line 199) | def _end_mantissa(self) -> int: method _end_exponent (line 203) | def _end_exponent(self) -> int: method exponent_bias (line 210) | def exponent_bias(self) -> int: method max_exponent_value (line 218) | def max_exponent_value(self) -> int: method min_exponent_value (line 226) | def min_exponent_value(self) -> int: method max_positive_normal_value (line 234) | def max_positive_normal_value(self) -> float: method min_positive_normal_value (line 246) | def min_positive_normal_value(self) -> float: method max_positive_subnormal (line 251) | def max_positive_subnormal(self) -> float: method min_positive_subnormal (line 261) | def min_positive_subnormal(self) -> float: method max_value (line 271) | def max_value(self) -> float: method min_value (line 276) | def min_value(self) -> float: method to_unsigned (line 290) | def to_unsigned(self) -> "QuantDataType": method get_codebook (line 299) | def get_codebook(self, *, device: torch.device | str = "cpu", dtype: t... method round (line 322) | def round(self, tensor: torch.Tensor) -> torch.Tensor: method from_str (line 339) | def from_str(cls, s: str, /) -> "QuantDataType": method _build_codebook (line 345) | def _build_codebook(self, *, device: torch.device | str = "cpu", dtype... method _build_default_name (line 362) | def _build_default_name(self) -> str: method _default_from_str (line 380) | def _default_from_str(s: str, /) -> "QuantDataType": method __str__ (line 423) | def __str__(self) -> str: method __repr__ (line 426) | def __repr__(self) -> str: method __eq__ (line 429) | def __eq__(self, value: object) -> bool: method __hash__ (line 434) | def __hash__(self) -> int: class _QDTypeMeta (line 438) | class _QDTypeMeta(type): method __getattr__ (line 439) | def __getattr__(cls, __name: str) -> tp.Any: class QDType (line 446) | class QDType(metaclass=_QDTypeMeta): FILE: deepcompressor/data/range.py class RangeBound (line 17) | class RangeBound: method is_set (line 23) | def is_set(self) -> bool: method to_dict (line 27) | def to_dict(self) -> dict[str, tp.Any]: method from_dict (line 32) | def from_dict(cls, data: dict[str, tp.Any] | None) -> tp.Optional[tp.S... class QuantRange (line 37) | class QuantRange(RangeBound): method log2 (line 40) | def log2(self) -> "LogQuantRange": method intersect (line 48) | def intersect(self, quant_dtype: QuantDataType, *, has_zero_point: boo... method intersect_log2 (line 68) | def intersect_log2(self, quant_dtype: QuantDataType) -> "LogQuantRange": method construct (line 82) | def construct( class LogQuantRange (line 102) | class LogQuantRange(QuantRange): method log2 (line 105) | def log2(self) -> "LogQuantRange": method intersect (line 109) | def intersect(self, quant_dtype: QuantDataType, *, has_zero_point: boo... method intersect_log2 (line 124) | def intersect_log2(self, quant_dtype: QuantDataType) -> "LogQuantRange": method construct (line 144) | def construct( class ProtectiveQuantRange (line 162) | class ProtectiveQuantRange(QuantRange): method construct (line 168) | def construct( class DynamicRange (line 242) | class DynamicRange: method __post_init__ (line 249) | def __post_init__(self) -> None: method is_set (line 253) | def is_set(self) -> bool: method intersect (line 257) | def intersect(self, range_bound: RangeBound | None) -> "DynamicRange": method measure (line 277) | def measure( # noqa: C901 method scale (line 358) | def scale( method construct (line 398) | def construct( method _format_m_ (line 408) | def _format_m_( method to_dict (line 429) | def to_dict(self) -> dict[str, tp.Any]: method from_dict (line 434) | def from_dict(cls, data: dict[str, tp.Any] | None) -> tp.Optional[tp.S... FILE: deepcompressor/data/scale.py class QuantScale (line 11) | class QuantScale: method __init__ (line 16) | def __init__(self): method num_children (line 20) | def num_children(self) -> int: method num_leaves (line 25) | def num_leaves(self) -> int: method is_quantized (line 29) | def is_quantized(self) -> bool: method get_child (line 33) | def get_child(self, index: int) -> "QuantScale": method append (line 37) | def append(self, scale: tp.Union[torch.Tensor, "QuantScale"]) -> "Quan... method extend (line 51) | def extend(self, scale: "QuantScale") -> "QuantScale": method join (line 62) | def join(self, scale: "QuantScale") -> "QuantScale": method remove_zero (line 66) | def remove_zero(self) -> "QuantScale": method state_dict (line 71) | def state_dict( function _join_scale_tensor (line 91) | def _join_scale_tensor(global_scale: torch.Tensor | None, local_scale: t... FILE: deepcompressor/data/tensor.py class QuantTensor (line 11) | class QuantTensor: method __init__ (line 20) | def __init__( method data (line 39) | def data(self) -> torch.Tensor | None: method qdata (line 44) | def qdata(self) -> torch.Tensor | None: FILE: deepcompressor/data/utils/dtype.py function infer_dtype_bits (line 11) | def infer_dtype_bits(dtype: torch.dtype | QuantDataType) -> int: function infer_dtype_name (line 43) | def infer_dtype_name(dtype: torch.dtype | QuantDataType) -> str: function eval_dtype (line 71) | def eval_dtype( # noqa: C901 FILE: deepcompressor/data/utils/reshape.py class ReshapeFn (line 16) | class ReshapeFn: method __call__ (line 19) | def __call__(self, x: torch.Tensor, /, ic_last: bool = True) -> torch.... class LinearReshapeFn (line 35) | class LinearReshapeFn(ReshapeFn): method __call__ (line 38) | def __call__(self, x: torch.Tensor, /, ic_last: bool = True) -> torch.... class ConvInputReshapeFn (line 54) | class ConvInputReshapeFn(ReshapeFn): method __init__ (line 57) | def __init__( method __call__ (line 77) | def __call__(self, x: torch.Tensor, /, ic_last: bool = True) -> torch.... class ConvOutputReshapedFn (line 104) | class ConvOutputReshapedFn(ReshapeFn): method __call__ (line 107) | def __call__(self, x: torch.Tensor, /, ic_last: bool = True) -> torch.... class AttentionInputReshapeFn (line 128) | class AttentionInputReshapeFn(ReshapeFn): method __init__ (line 131) | def __init__(self, channels_dim: int) -> None: method __call__ (line 140) | def __call__(self, x: torch.Tensor, /, ic_last: bool = True) -> torch.... FILE: deepcompressor/data/utils/scale.py function infer_scale_dtypes (line 13) | def infer_scale_dtypes( function infer_scale_quant_spans (line 34) | def infer_scale_quant_spans(scale_dtypes: tp.Sequence[QuantDataType], ba... function infer_exponent_scale_level (line 42) | def infer_exponent_scale_level(scale_dtypes: tp.Sequence[torch.dtype | Q... FILE: deepcompressor/data/utils/shape.py function infer_group_shape_name (line 14) | def infer_group_shape_name(group_shape: tp.Sequence[int]) -> str: function format_group_configs (line 58) | def format_group_configs( function infer_group_shapes (line 105) | def infer_group_shapes(group_shapes: tuple[tuple[int, ...], ...], shape:... function infer_view_shape (line 142) | def infer_view_shape( function infer_scale_view_shapes (line 173) | def infer_scale_view_shapes( function infer_shape (line 203) | def infer_shape(view_shape: torch.Size) -> torch.Size: FILE: deepcompressor/data/zero.py class ZeroPointDomain (line 9) | class ZeroPointDomain(enum.Enum): FILE: deepcompressor/dataset/action.py class CacheHook (line 16) | class CacheHook(IOHook): method __init__ (line 17) | def __init__( method pre_forward (line 47) | def pre_forward( method post_forward (line 60) | def post_forward( class CacheAction (line 75) | class CacheAction(ABC): method __init__ (line 80) | def __init__(self, device: torch.device | str | None = None) -> None: method apply (line 90) | def apply( method info (line 112) | def info( method get_input_packager (line 133) | def get_input_packager(self, name: str, module: nn.Module, cache: Tens... method get_output_packager (line 150) | def get_output_packager(self, name: str, module: nn.Module, cache: Ten... method register (line 167) | def register( class ConcatCacheAction (line 206) | class ConcatCacheAction(CacheAction): method apply (line 209) | def apply( method info (line 238) | def info( FILE: deepcompressor/dataset/cache.py class BaseCalibCacheLoader (line 28) | class BaseCalibCacheLoader(ABC): method __init__ (line 34) | def __init__(self, dataset: torch.utils.data.Dataset, batch_size: int): method num_samples (line 47) | def num_samples(self) -> int: method iter_samples (line 52) | def iter_samples(self, *args, **kwargs) -> tp.Generator[ModuleForwardI... method _init_cache (line 56) | def _init_cache(self, name: str, module: nn.Module) -> IOTensorsCache: method _convert_layer_inputs (line 93) | def _convert_layer_inputs( method _convert_layer_outputs (line 115) | def _convert_layer_outputs(self, m: nn.Module, outputs: tp.Any) -> dic... method _layer_forward_pre_hook (line 133) | def _layer_forward_pre_hook( method _iter_layer_activations (line 151) | def _iter_layer_activations( # noqa: C901 method iter_layer_activations (line 430) | def iter_layer_activations( # noqa: C901 FILE: deepcompressor/dataset/config.py class BaseDataLoaderConfig (line 17) | class BaseDataLoaderConfig(ABC): method generate_dirnames (line 33) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: method build_dataset (line 48) | def build_dataset(self, *args, **kwargs) -> Dataset: method build_loader (line 53) | def build_loader(self, *args, **kwargs) -> DataLoader | BaseCalibCache... FILE: deepcompressor/nn/patch/conv.py class ConcatConv2d (line 14) | class ConcatConv2d(nn.Module): method __init__ (line 15) | def __init__( method forward (line 53) | def forward(self, x: torch.Tensor) -> torch.Tensor: method from_conv2d (line 62) | def from_conv2d(conv: nn.Conv2d, splits: list[int]) -> "ConcatConv2d": class ShiftedConv2d (line 91) | class ShiftedConv2d(nn.Module): method __init__ (line 94) | def __init__( method forward (line 148) | def forward(self, input: torch.Tensor) -> torch.Tensor: method from_conv2d (line 155) | def from_conv2d(conv: nn.Conv2d, shift: float | torch.Tensor) -> "Shif... FILE: deepcompressor/nn/patch/linear.py class ConcatLinear (line 10) | class ConcatLinear(nn.Module): method __init__ (line 11) | def __init__( method forward (line 38) | def forward(self, x: torch.Tensor) -> torch.Tensor: method from_linear (line 47) | def from_linear(linear: nn.Linear, splits: list[int]) -> "ConcatLinear": class ShiftedLinear (line 70) | class ShiftedLinear(nn.Module): method __init__ (line 73) | def __init__( method in_features (line 96) | def in_features(self) -> int: method out_features (line 100) | def out_features(self) -> int: method forward (line 103) | def forward(self, input: torch.Tensor) -> torch.Tensor: method from_linear (line 107) | def from_linear(linear: nn.Linear, shift: float | torch.Tensor) -> "Sh... FILE: deepcompressor/nn/patch/lowrank.py class LowRankBranch (line 12) | class LowRankBranch(nn.Module): method __init__ (line 13) | def __init__( method reset_parameters (line 30) | def reset_parameters(self, weight: torch.Tensor | None = None) -> None: method get_effective_weight (line 61) | def get_effective_weight(self) -> torch.Tensor | None: method forward (line 69) | def forward(self, input: torch.Tensor) -> torch.Tensor | None: method as_hook (line 87) | def as_hook( FILE: deepcompressor/nn/patch/sdpa.py class ScaleDotProductAttention (line 13) | class ScaleDotProductAttention(nn.Module): method forward (line 14) | def forward( FILE: deepcompressor/nn/struct/attn.py class AttentionConfigStruct (line 28) | class AttentionConfigStruct: method head_size (line 60) | def head_size(self) -> int: method num_key_value_groups (line 65) | def num_key_value_groups(self) -> int: method num_channels (line 70) | def num_channels(self) -> int: method num_add_channels (line 75) | def num_add_channels(self) -> int: method num_query_channels (line 80) | def num_query_channels(self) -> int: method num_key_value_channels (line 85) | def num_key_value_channels(self) -> int: method num_head_channels (line 90) | def num_head_channels(self) -> int: method num_head_repeats (line 95) | def num_head_repeats(self) -> int: class FeedForwardConfigStruct (line 101) | class FeedForwardConfigStruct: method num_channels (line 125) | def num_channels(self) -> int: method num_intermediate_channels (line 130) | def num_intermediate_channels(self) -> int: method intermediate_lowerbound (line 135) | def intermediate_lowerbound(self) -> float | None: method infer_lowerbound (line 140) | def infer_lowerbound(act_type: str) -> float | None: class AttentionStruct (line 158) | class AttentionStruct(BaseModuleStruct): method qkv_proj (line 236) | def qkv_proj(self) -> list[nn.Linear]: method add_qkv_proj (line 240) | def add_qkv_proj(self) -> list[nn.Linear]: method out_proj (line 249) | def out_proj(self) -> nn.Linear: method add_out_proj (line 253) | def add_out_proj(self) -> nn.Linear: method qkv_proj_rnames (line 257) | def qkv_proj_rnames(self) -> list[str]: method add_qkv_proj_rnames (line 263) | def add_qkv_proj_rnames(self) -> list[str]: method out_proj_rname (line 272) | def out_proj_rname(self) -> str: method add_out_proj_rname (line 276) | def add_out_proj_rname(self) -> str: method qkv_proj_names (line 280) | def qkv_proj_names(self) -> list[str]: method add_qkv_proj_names (line 284) | def add_qkv_proj_names(self) -> list[str]: method out_proj_name (line 293) | def out_proj_name(self) -> str: method add_out_proj_name (line 297) | def add_out_proj_name(self) -> str: method __post_init__ (line 302) | def __post_init__(self) -> None: method is_self_attn (line 370) | def is_self_attn(self) -> bool: method is_cross_attn (line 373) | def is_cross_attn(self) -> bool: method is_joint_attn (line 376) | def is_joint_attn(self) -> bool: method filter_kwargs (line 379) | def filter_kwargs(self, kwargs: dict) -> dict: method named_key_modules (line 383) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method iter_attention_structs (line 399) | def iter_attention_structs(self) -> tp.Generator[tp.Self, None, None]: method get_default_keys (line 403) | def get_default_keys(cls) -> list[str]: class SelfAttentionStruct (line 409) | class SelfAttentionStruct(AttentionStruct): method get_default_keys (line 430) | def get_default_keys(cls) -> list[str]: class CrossAttentionStruct (line 436) | class CrossAttentionStruct(AttentionStruct): method get_default_keys (line 457) | def get_default_keys(cls) -> list[str]: class JointAttentionStruct (line 463) | class JointAttentionStruct(AttentionStruct): class FeedForwardStruct (line 481) | class FeedForwardStruct(BaseModuleStruct): method __post_init__ (line 521) | def __post_init__(self) -> None: method named_key_modules (line 561) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... class TransformerBlockStruct (line 577) | class TransformerBlockStruct(BaseModuleStruct): method __post_init__ (line 645) | def __post_init__(self) -> None: method named_key_modules (line 705) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method iter_attention_structs (line 713) | def iter_attention_structs(self) -> tp.Generator[AttentionStruct, None... method iter_transformer_block_structs (line 717) | def iter_transformer_block_structs(self) -> tp.Generator[tp.Self, None... class BaseTransformerStruct (line 722) | class BaseTransformerStruct(BaseModuleStruct): method num_blocks (line 759) | def num_blocks(self) -> int: method block_structs (line 765) | def block_structs(self) -> list[TransformerBlockStruct]: method block_names (line 771) | def block_names(self) -> list[str]: method __post_init__ (line 775) | def __post_init__(self) -> None: method named_key_modules (line 787) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method iter_attention_structs (line 795) | def iter_attention_structs(self) -> tp.Generator[AttentionStruct, None... method iter_transformer_block_structs (line 799) | def iter_transformer_block_structs(self) -> tp.Generator[TransformerBl... FILE: deepcompressor/nn/struct/base.py class BaseModuleStruct (line 17) | class BaseModuleStruct(ABC): method __post_init__ (line 42) | def __post_init__(self) -> None: method __call__ (line 60) | def __call__(self, *args: tp.Any, **kwds: tp.Any) -> tp.Any: method named_key_modules (line 64) | def named_key_modules(self) -> tp.Generator[tp.Tuple[str, str, nn.Modu... method get_default_keys (line 69) | def get_default_keys(cls) -> list[str]: method register_factory (line 74) | def register_factory( method construct (line 116) | def construct( FILE: deepcompressor/quantizer/config/base.py class BaseQuantizerConfig (line 25) | class BaseQuantizerConfig(EnableConfig): method quant_dtype (line 30) | def quant_dtype(self) -> QuantDataType | None: method zero_domain (line 36) | def zero_domain(self) -> ZeroPointDomain | None: method largest_group_shape (line 42) | def largest_group_shape(self) -> tp.Sequence[int]: method smallest_group_shape (line 48) | def smallest_group_shape(self) -> tp.Sequence[int]: method is_enabled (line 52) | def is_enabled(self) -> bool: method decompose (line 57) | def decompose(self) -> "DecomposedQuantizerConfig": method generate_dirnames (line 61) | def generate_dirnames( class DecomposedQuantizerConfig (line 90) | class DecomposedQuantizerConfig(BaseQuantizerConfig): method quant_dtype (line 95) | def quant_dtype(self) -> QuantDataType | None: method zero_domain (line 99) | def zero_domain(self) -> ZeroPointDomain | None: method largest_group_shape (line 103) | def largest_group_shape(self) -> tp.Sequence[int]: method smallest_group_shape (line 107) | def smallest_group_shape(self) -> tp.Sequence[int]: method num_steps (line 111) | def num_steps(self) -> int: method decompose (line 114) | def decompose(self) -> "DecomposedQuantizerConfig": method __eq__ (line 117) | def __eq__(self, value: object) -> bool: method _get_effective_bits (line 135) | def _get_effective_bits( method _get_dtype_name (line 165) | def _get_dtype_name(self, default_dtype: torch.dtype = torch.float16) ... method _get_group_shapes_name (line 185) | def _get_group_shapes_name(self, default_dtype: torch.dtype = torch.fl... method generate_dirnames (line 212) | def generate_dirnames( class QuantizerConfig (line 249) | class QuantizerConfig(BaseQuantizerConfig): method __post_init__ (line 273) | def __post_init__(self) -> None: method quant_dtype (line 281) | def quant_dtype(self) -> QuantDataType | None: method zero_domain (line 286) | def zero_domain(self) -> ZeroPointDomain | None: method largest_group_shape (line 291) | def largest_group_shape(self) -> tp.Sequence[int]: method smallest_group_shape (line 296) | def smallest_group_shape(self) -> tp.Sequence[int]: method decompose (line 300) | def decompose(self) -> DecomposedQuantizerConfig: class ProgressiveQuantizerConfig (line 307) | class ProgressiveQuantizerConfig(QuantizerConfig): method __post_init__ (line 335) | def __post_init__(self) -> None: method decompose (line 357) | def decompose(self) -> DecomposedQuantizerConfig: FILE: deepcompressor/quantizer/config/kernel.py class BaseQuantKernel (line 18) | class BaseQuantKernel(ABC): method quantize (line 22) | def quantize( class BaseQuantKernelConfig (line 60) | class BaseQuantKernelConfig(ABC): method name (line 65) | def name(self) -> str: method build (line 70) | def build(self) -> BaseQuantKernel: method generate_dirnames (line 75) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: class BaseKeyEnableQuantKernelConfig (line 91) | class BaseKeyEnableQuantKernelConfig(KeyEnableConfig, EnableConfig): method __post_init__ (line 99) | def __post_init__(self) -> None: method is_enabled (line 102) | def is_enabled(self) -> bool: method is_enabled_for (line 105) | def is_enabled_for(self, key: str) -> bool: method specialize_for (line 108) | def specialize_for(self, key: str) -> BaseQuantKernelConfig | None: method generate_dirnames (line 121) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: method organize (line 140) | def organize(self) -> None: FILE: deepcompressor/quantizer/config/lowrank.py class QuantLowRankConfig (line 15) | class QuantLowRankConfig(EnableConfig): method is_enabled (line 31) | def is_enabled(self) -> bool: method generate_dirnames (line 34) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: FILE: deepcompressor/quantizer/impl/base.py class QuantizerImpl (line 23) | class QuantizerImpl: method is_enabled (line 41) | def is_enabled(self) -> bool: method quantize (line 49) | def quantize( method _quantize (line 132) | def _quantize( # noqa: C901 method update (line 289) | def update( FILE: deepcompressor/quantizer/impl/info.py class QuantStepInfo (line 19) | class QuantStepInfo: method __post_init__ (line 39) | def __post_init__(self): method tensor_zero_domain (line 52) | def tensor_zero_domain(self) -> ZeroPointDomain | None: method tensor_quant_range (line 56) | def tensor_quant_range(self) -> QuantRange: method tensor_range_bound (line 61) | def tensor_range_bound(self) -> RangeBound | None: method to_config (line 64) | def to_config(self) -> QuantizerConfig: method construct (line 73) | def construct( class QuantInfo (line 97) | class QuantInfo: method num_steps (line 102) | def num_steps(self) -> int: method get_child (line 105) | def get_child(self, idx: int) -> QuantStepInfo: method is_outdated (line 108) | def is_outdated( method construct (line 141) | def construct( FILE: deepcompressor/quantizer/impl/scale.py function quantize_scale (line 20) | def quantize_scale( class QuantScaleInfo (line 68) | class QuantScaleInfo: method has_zero_point (line 95) | def has_zero_point(self) -> bool: method __post_init__ (line 98) | def __post_init__(self): method quantize (line 142) | def quantize( FILE: deepcompressor/quantizer/impl/simple.py function simple_quantize (line 13) | def simple_quantize( FILE: deepcompressor/quantizer/impl/ste.py class STEFunction (line 11) | class STEFunction(torch.autograd.Function): method forward (line 15) | def forward(ctx: tp.Any, tensor: torch.Tensor, fn: tp.Callable[[torch.... method backward (line 20) | def backward(ctx: tp.Any, grad_output: torch.Tensor) -> tp.Tuple[torch... function ste (line 25) | def ste(tensor: torch.Tensor, fn: tp.Callable[[torch.Tensor], torch.Tens... FILE: deepcompressor/quantizer/kernel/gptq.py class QuantGptqConfig (line 25) | class QuantGptqConfig(BaseQuantKernelConfig): method name (line 45) | def name(self) -> str: method build (line 48) | def build(self) -> "QuantGptqKernel": method generate_dirnames (line 51) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: class QuantGptqKernel (line 66) | class QuantGptqKernel(BaseQuantKernel): method __init__ (line 67) | def __init__(self, config: "QuantGptqConfig"): method quantize (line 70) | def quantize( function gptq_quantize (line 129) | def gptq_quantize( # noqa: C901 FILE: deepcompressor/quantizer/kernel/rtn.py class QuantRtnKernel (line 15) | class QuantRtnKernel(BaseQuantKernel): method quantize (line 18) | def quantize( function rtn_quantize (line 68) | def rtn_quantize( FILE: deepcompressor/quantizer/processor.py class Quantizer (line 24) | class Quantizer(QuantizerImpl, BaseTensorProcessor): method is_enabled_low_rank (line 77) | def is_enabled_low_rank(self) -> bool: method get_input_packager (line 84) | def get_input_packager(self) -> BaseInputPackager | None: method get_output_packager (line 87) | def get_output_packager(self) -> BaseOutputPackager | None: method process (line 90) | def process(self, tensor: torch.Tensor) -> torch.Tensor: method quantize (line 93) | def quantize( method update (line 185) | def update( method quantize_with_low_rank (line 215) | def quantize_with_low_rank( method state_dict (line 312) | def state_dict(self, device: torch.device | str = "cpu") -> dict[str, ... method load_state_dict (line 341) | def load_state_dict(self, state_dict: dict[str, tp.Any], device: torch... FILE: deepcompressor/utils/common.py function join_name (line 22) | def join_name(prefix: str, name: str, sep: str = ".", relative: bool = T... function join_names (line 56) | def join_names(*names: str, sep: str = ".", relative: bool = True) -> str: function num2str (line 76) | def num2str(num: int | float) -> str: function split_sequence (line 93) | def split_sequence(lst: tp.Sequence[tp.Any], splits: tp.Sequence[int]) -... function tree_map (line 115) | def tree_map(func: tp.Callable[[tp.Any], tp.Any], tree: tp.Any) -> tp.Any: function tree_copy_with_ref (line 127) | def tree_copy_with_ref( function tree_split (line 148) | def tree_split(tree: tp.Any) -> list[tp.Any]: function tree_collate (line 187) | def tree_collate(batch: list[tp.Any] | tuple[tp.Any, ...]) -> tp.Any: function hash_str_to_int (line 203) | def hash_str_to_int(s: str) -> int: FILE: deepcompressor/utils/config/base.py class EnableConfig (line 13) | class EnableConfig(ABC): method is_enabled (line 15) | def is_enabled(self) -> bool: class KeyEnableConfig (line 20) | class KeyEnableConfig(ABC): method is_enabled_for (line 22) | def is_enabled_for(self, key: str) -> bool: class SkipBasedConfig (line 29) | class SkipBasedConfig(KeyEnableConfig, EnableConfig): method __post_init__ (line 39) | def __post_init__(self) -> None: method is_enabled (line 45) | def is_enabled(self) -> bool: method is_enabled_for (line 49) | def is_enabled_for(self, key: str) -> bool: method generate_dirnames (line 62) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: method update_get_arguments (line 79) | def update_get_arguments( method update_from_dict (line 103) | def update_from_dict( class IncludeBasedConfig (line 118) | class IncludeBasedConfig(KeyEnableConfig, EnableConfig): method __post_init__ (line 128) | def __post_init__(self) -> None: method is_enabled (line 134) | def is_enabled(self) -> bool: method is_enabled_for (line 138) | def is_enabled_for(self, key: str) -> bool: method generate_dirnames (line 151) | def generate_dirnames(self, *, prefix: str = "", **kwargs) -> list[str]: method update_get_arguments (line 171) | def update_get_arguments( method update_from_dict (line 195) | def update_from_dict( FILE: deepcompressor/utils/config/model.py class BaseModelConfig (line 16) | class BaseModelConfig(ABC): method __post_init__ (line 41) | def __post_init__(self): method build (line 53) | def build(self, *args, **kwargs) -> tp.Any: FILE: deepcompressor/utils/config/output.py class OutputConfig (line 15) | class OutputConfig: method __post_init__ (line 39) | def __post_init__(self): method running_dirpath (line 44) | def running_dirpath(self) -> str: method error_dirpath (line 49) | def error_dirpath(self) -> str: method job_dirname (line 54) | def job_dirname(self) -> str: method job_dirpath (line 59) | def job_dirpath(self) -> str: method running_job_dirname (line 64) | def running_job_dirname(self) -> str: method error_job_dirname (line 69) | def error_job_dirname(self) -> str: method running_job_dirpath (line 74) | def running_job_dirpath(self) -> str: method lock (line 78) | def lock(self) -> None: method unlock (line 89) | def unlock(self, error: bool = False) -> None: method is_locked_by_others (line 96) | def is_locked_by_others(self) -> bool: method get_running_path (line 104) | def get_running_path(self, filename: str) -> str: method get_running_job_path (line 109) | def get_running_job_path(self, filename: str) -> str: method generate_timestamp (line 115) | def generate_timestamp() -> str: FILE: deepcompressor/utils/config/path.py class BasePathConfig (line 12) | class BasePathConfig: method is_all_set (line 15) | def is_all_set(self) -> bool: method is_all_empty (line 28) | def is_all_empty(self) -> bool: method clone (line 41) | def clone(self) -> tp.Self: method add_parent_dirs (line 51) | def add_parent_dirs(self, *parent_dirs: str) -> tp.Self: method add_children (line 65) | def add_children(self, *children: str) -> tp.Self: method to_dirpath (line 79) | def to_dirpath(self) -> tp.Self: method apply (line 88) | def apply(self, fn: tp.Callable) -> tp.Self: FILE: deepcompressor/utils/dataclass.py function get_fields (line 9) | def get_fields(class_or_instance, *, init_vars: bool = False, class_vars... FILE: deepcompressor/utils/hooks/branch.py class AccumBranchHook (line 15) | class AccumBranchHook(IOHook): method __init__ (line 18) | def __init__( method pre_forward (line 28) | def pre_forward( method post_forward (line 43) | def post_forward( FILE: deepcompressor/utils/hooks/hook.py class Hook (line 17) | class Hook: method __init__ (line 25) | def __init__(self, *, pre: bool, post: bool) -> None: method is_in_hook (line 44) | def is_in_hook(self) -> bool: method is_out_hook (line 48) | def is_out_hook(self) -> bool: method is_inout_hook (line 52) | def is_inout_hook(self) -> bool: method activate (line 56) | def activate(self) -> tp.Self: method deactivate (line 61) | def deactivate(self) -> tp.Self: method pre_forward (line 66) | def pre_forward( method post_forward (line 81) | def post_forward( method __call__ (line 102) | def __call__(self, *args, **kwargs) -> tp.Any: method register (line 113) | def register( method remove (line 143) | def remove(self, module: nn.Module | tp.Iterable[nn.Module] | None = N... class EarlyStopException (line 167) | class EarlyStopException(Exception): class EarlyStopHook (line 173) | class EarlyStopHook(Hook): method __init__ (line 174) | def __init__(self): method pre_forward (line 177) | def pre_forward(self, *args, **kwargs) -> None: class IOHook (line 181) | class IOHook(Hook): method __init__ (line 189) | def __init__( FILE: deepcompressor/utils/hooks/packager.py class BaseInputPackager (line 24) | class BaseInputPackager(ABC): method unpack (line 28) | def unpack( method repack (line 48) | def repack( class SimpleInputPackager (line 74) | class SimpleInputPackager(BaseInputPackager): method unpack (line 75) | def unpack( method repack (line 80) | def repack( class KeyedInputPackager (line 90) | class KeyedInputPackager(BaseInputPackager): method __init__ (line 91) | def __init__(self, module: nn.Module, index_or_keys: list[int | str]): method unpack (line 127) | def unpack( method repack (line 139) | def repack( class BaseOutputPackager (line 156) | class BaseOutputPackager(ABC): method unpack (line 160) | def unpack( method repack (line 186) | def repack( class SimpleOutputPackager (line 215) | class SimpleOutputPackager(BaseOutputPackager): method unpack (line 216) | def unpack( method repack (line 227) | def repack( class KeyedOutputPackager (line 241) | class KeyedOutputPackager(BaseOutputPackager): method __init__ (line 242) | def __init__(self, index_or_keys: list[int | str]): method unpack (line 245) | def unpack( method repack (line 268) | def repack( FILE: deepcompressor/utils/hooks/processor.py class BaseTensorProcessor (line 18) | class BaseTensorProcessor(abc.ABC): method is_enabled (line 20) | def is_enabled(self) -> bool: ... method get_input_packager (line 23) | def get_input_packager(self) -> BaseInputPackager | None: ... method get_output_packager (line 26) | def get_output_packager(self) -> BaseOutputPackager | None: ... method process (line 29) | def process(self, tensor: torch.Tensor) -> torch.Tensor: ... method as_hook (line 31) | def as_hook( class ProcessHook (line 49) | class ProcessHook(IOHook): method __init__ (line 50) | def __init__( method process (line 65) | def process(self, tensors: dict[int | str, torch.Tensor]) -> dict[int ... method pre_forward (line 74) | def pre_forward( method post_forward (line 83) | def post_forward( FILE: deepcompressor/utils/math/functional.py function is_pow2 (line 9) | def is_pow2(n: int) -> bool: function root_ (line 23) | def root_(y: torch.Tensor, index: float) -> torch.Tensor: FILE: deepcompressor/utils/math/hadamard.py function _matmul_hadU (line 17) | def _matmul_hadU(X: torch.Tensor, hadamard_K: torch.Tensor | None, K: in... function random_hadamard_matrix (line 38) | def random_hadamard_matrix(size: int) -> torch.Tensor: function hardmard_transform (line 48) | def hardmard_transform( class HadamardMatrix (line 65) | class HadamardMatrix: method get (line 72) | def get( method get_lhs (line 89) | def get_lhs(n: int) -> tuple[torch.FloatTensor, int]: method _get_hadamard_k (line 99) | def _get_hadamard_k(k: int) -> torch.FloatTensor: method _get_hadamard_12 (line 106) | def _get_hadamard_12() -> torch.FloatTensor: method _get_hadamard_40 (line 125) | def _get_hadamard_40() -> torch.FloatTensor: method _get_hadamard_20 (line 1812) | def _get_hadamard_20() -> torch.FloatTensor: method _get_hadamard_28 (line 1839) | def _get_hadamard_28() -> torch.FloatTensor: method _get_hadamard_36 (line 2686) | def _get_hadamard_36() -> torch.FloatTensor: method _get_hadamard_60 (line 4061) | def _get_hadamard_60() -> torch.FloatTensor: method _get_hadamard_52 (line 7788) | def _get_hadamard_52() -> torch.FloatTensor: method _get_hadamard_108 (line 10603) | def _get_hadamard_108() -> torch.FloatTensor: method _get_hadamard_140 (line 22490) | def _get_hadamard_140() -> torch.FloatTensor: method _get_hadamard_156 (line 42377) | def _get_hadamard_156() -> torch.FloatTensor: method _get_hadamard_172 (line 67032) | def _get_hadamard_172() -> torch.FloatTensor: FILE: deepcompressor/utils/patch.py function copy_func (line 14) | def copy_func(f: types.FunctionType, globals: dict[str, typing.Any] | No... function get_module_parents_map (line 39) | def get_module_parents_map( FILE: deepcompressor/utils/tools/logging.py function getLogger (line 48) | def getLogger(name: str | None = None) -> logging.Logger: function log (line 60) | def log(level: int, msg: str, logger: logging.Logger | None = None) -> N... function info (line 81) | def info(msg: str, logger: logging.Logger | None = None): function debug (line 92) | def debug(msg: str, logger: logging.Logger | None = None): function warning (line 103) | def warning(msg: str, logger: logging.Logger | None = None): function error (line 114) | def error(msg: str, logger: logging.Logger | None = None): function critical (line 125) | def critical(msg: str, logger: logging.Logger | None = None): class Formatter (line 136) | class Formatter(logging.Formatter): method __init__ (line 141) | def __init__(self, fmt: str | None = None, datefmt: str | None = None,... method format (line 151) | def format(self, record: logging.LogRecord) -> str: method indent_inc (line 178) | def indent_inc(delta: int = 2): method indent_dec (line 183) | def indent_dec(delta: int = 2): method indent_reset (line 188) | def indent_reset(indent: int = 0): function basicConfig (line 193) | def basicConfig(**kwargs) -> None: function setup (line 203) | def setup( FILE: deepcompressor/utils/tools/sys.py function _get_visible_gpu_capacity_list (line 10) | def _get_visible_gpu_capacity_list() -> list[int]: function _get_ram_capacity (line 19) | def _get_ram_capacity() -> int: function get_max_memory_map (line 28) | def get_max_memory_map(ratio: float = 0.9) -> dict[str, str]: