llmcompressor.entrypoints.utils
get_processor_name_from_model(student, teacher)
Get a processor/tokenizer source used for both student and teacher, assuming that they could be shared
Parameters:
Name | Type | Description | Default |
---|---|---|---|
student | Module | the student model | required |
teacher | Optional[Module] | the teacher model | required |
Returns:
Type | Description |
---|---|
str | the source for the processor/tokenizer shared between teacher and model |
Source code in src/llmcompressor/entrypoints/utils.py
post_process(model_args=None, recipe_args=None, output_dir=None)
Saves the model and tokenizer/processor to the output directory if model_args, output_dir is provided.
Save is skipped for stage runs for train
- saves using the trainer.save_model()
If the output_dir
is not the default directory, the method resets lifecycle actions. The model is saved in a compressed format if specified in model_args
. Additionally, the tokenizer or processor, if available, is also saved.
Raises: ValueError: If saving fails due to an invalid output_dir
or other issues.
Source code in src/llmcompressor/entrypoints/utils.py
pre_process(model_args)
Prepares the model and tokenizer/processor for calibration. - Initializes the model if it's specified as a path or string. - Applies patches to fix tied tensor issues and modifies save_pretrained
behavior. - Initializes the processor if specified as a path or None
. - Sets the minimum tokens per module if dataset_args
are provided. Raises: FileNotFoundError: If the model or processor path is invalid.