llmcompressor.utils.dev
patch_transformers_logger_level(level=logging.ERROR)
Context under which the transformers logger's level is modified
This can be used with skip_weights_download
to squelch warnings related to missing parameters in the checkpoint
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level | int | new logging level for transformers logger. Logs whose level is below this level will not be logged | ERROR |
Source code in src/llmcompressor/utils/dev.py
skip_weights_download(model_class=AutoModelForCausalLM)
Context manager under which models are initialized without having to download the model weight files. This differs from init_empty_weights
in that weights are allocated on to assigned devices with random values, as opposed to being on the meta device
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_class | Type[PreTrainedModel] | class to patch, defaults to | AutoModelForCausalLM |
Source code in src/llmcompressor/utils/dev.py
skip_weights_initialize(use_zeros=False)
Very similar to transformers.model_utils.no_init_weights
, except that torch.Tensor initialization functions are also patched to account for tensors which are initialized not on the meta device