Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/llmcompressor/transformers/finetune/session_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,12 @@ def save_model(
# is True by default to avoid high runtime cost
self.save_state()
if self.accelerator.is_main_process:
processor = getattr(self, "processing_class", self.tokenizer)
# TODO: need to port over all saving parameters so that all
# checkpoints are saved in the same way
save_checkpoint(
output_dir,
model=self.model,
processor=processor,
processor=self.processing_class,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This direct access to self.processing_class could be brittle and may raise an AttributeError if the attribute doesn't exist. It seems processing_class is a typo for processor, which is a standard attribute on the transformers.Trainer.

To make this more robust, I recommend using getattr to safely access self.processor. The save_checkpoint function correctly handles cases where the processor is None.

Suggested change
processor=self.processing_class,
processor=getattr(self, "processor", None),

save_safetensors=self.args.save_safetensors,
save_compressed=self.model_args.save_compressed,
skip_sparsity_compression_stats=skip_sparsity_compression_stats,
Expand Down