Skip to content

Commit afabe5a

Browse files
committed
patch processor
Signed-off-by: Kyle Sayers <[email protected]>
1 parent de38a64 commit afabe5a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/llmcompressor/transformers/finetune/text_generation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,13 @@ def configure_processor(processor: Processor):
300300
" when padding"
301301
)
302302

303+
# the chat template attribute is required for saving, patch some processors which do
304+
# no include this attribute (phi3_v)
305+
processor_ct = getattr(processor, "chat_template", None)
306+
tokenizer_ct = getattr(tokenizer, "chat_template", None)
307+
if processor_ct is None and tokenizer_ct is not None:
308+
processor.chat_template = tokenizer.chat_template
309+
303310

304311
def main(
305312
model_args: ModelArguments,

0 commit comments

Comments
 (0)