Fix save_pretrained / from_pretrained round-trip for KimiK25VisionProcessor

#37

Problem

processor.save_pretrained() serializes transient Hub kwargs (revision, _from_auto, cache_dir, force_download, local_files_only) into preprocessor_config.json. On reload, from_pretrained passes these same kwargs again, and from_dict merges **config with **kwargs — causing a TypeError: got multiple values for keyword argument:

from transformers import AutoProcessor

processor = AutoProcessor.from_pretrained("moonshotai/Kimi-K2.6")
processor.save_pretrained("/tmp/test")
AutoProcessor.from_pretrained("/tmp/test", trust_remote_code=True)
# TypeError: KimiK25VisionProcessor() got multiple values for keyword argument 'revision'

Fix

Strip transient loading kwargs in __init__, from_dict, and to_dict so they are never stored as instance attributes or serialized.

Ready to merge
This branch is ready to get merged automatically.

Sign up or log in to comment