llmcompressor.transformers.tracing.debug
Functions:
-
trace
–Debug traceability by tracing a pre-trained model into subgraphs
trace
trace(
model_id: str,
model_class: Type[PreTrainedModel],
sequential_targets: Optional[
Union[List[str], str]
] = None,
ignore: Union[
List[str], str
] = DatasetArguments().tracing_ignore,
modality: str = "text",
trust_remote_code: bool = True,
skip_weights: bool = True,
device_map: Union[str, Dict] = "cpu",
) -> Tuple[
PreTrainedModel, List[Subgraph], Dict[str, torch.Tensor]
]
Debug traceability by tracing a pre-trained model into subgraphs
Parameters:
-
model_id
str
) –stub of the model to load
-
model_class
Type[PreTrainedModel]
) –class constructor of the pre-trained model. Can use either HF transformers classes or
Traceable
classes defined by LLM Compressor -
sequential_targets
Optional[Union[List[str], str]]
, default:None
) –targets for sequential tracing, defaults to automatic inference
-
ignore
Union[List[str], str]
, default:tracing_ignore
) –patterns to ignore during tracing
-
modality
str
, default:'text'
) –data modality for dummy tracing data, defaults to 'text'
-
trust_remote_code
bool
, default:True
) –trust remote model code Example usage from CLI llmcompressor.trace --model_id Qwen/Qwen2-VL-2B-Instruct --model_class Qwen2VLForConditionalGeneration --sequential_targets Qwen2VLDecoderLayer --ignore "lm_head" "re:visual.*" --modality text