fix loading processor after save_pretrained with transformers 4.49+
Browse filessave_pretrained additionally save chat_template.json file and trying to load it into processor, but there is no field for this argument.
As the result we got
File "~/python3.11/site-packages/transformers/processing_utils.py", line 868, in from_args_and_dict
processor = cls(*args, **processor_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Phi4MMProcessor.__init__() got an unexpected keyword argument 'chat_template'
the same issue also visible in phi-3-vision and phi-3.5-vision
- processing_phi4mm.py +1 -1
processing_phi4mm.py
CHANGED
@@ -506,7 +506,7 @@ class Phi4MMProcessor(ProcessorMixin):
|
|
506 |
image_processor_class = "AutoImageProcessor" # Phi4MMImageProcessor will be registered later
|
507 |
audio_processor_class = "AutoFeatureExtractor" # Phi4MMAudioFeatureExtractor will be registered later
|
508 |
|
509 |
-
def __init__(self, image_processor, audio_processor, tokenizer):
|
510 |
self.image_processor = image_processor
|
511 |
self.audio_processor = audio_processor
|
512 |
self.tokenizer = tokenizer
|
|
|
506 |
image_processor_class = "AutoImageProcessor" # Phi4MMImageProcessor will be registered later
|
507 |
audio_processor_class = "AutoFeatureExtractor" # Phi4MMAudioFeatureExtractor will be registered later
|
508 |
|
509 |
+
def __init__(self, image_processor, audio_processor, tokenizer, **kwargs):
|
510 |
self.image_processor = image_processor
|
511 |
self.audio_processor = audio_processor
|
512 |
self.tokenizer = tokenizer
|