Non-existant API Call - Request for Help

#21
by sjlee1234 - opened

When this is called: transformers.AutoModelForCausalLM.from_pretrained("tiny-random/kimi-linear") to load a smaller, randomly initialized version of kimi linear,
It comes up with this error: ImportError: cannot import name 'OutputRecorder' from 'transformers.utils.generic' (/opt/homebrew/lib/python3.14/site-packages/transformers/utils/generic.py) which originates from modeling_kimi.py from moonshotai/Kimi-Linear-48B-A3B-Instruct.
I am currently using transformers==5.2.0 and would like a workaround or a fix.
Thank you.

Full error message:
File /opt/homebrew/lib/python3.14/site-packages/transformers/models/auto/auto_factory.py:356, in _BaseAutoModelClass.from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs)
353 kwargs["adapter_kwargs"] = adapter_kwargs
355 if has_remote_code and trust_remote_code:
--> 356 model_class = get_class_from_dynamic_module(
357 class_ref, pretrained_model_name_or_path, code_revision=code_revision, **hub_kwargs, **kwargs
358 )
359 _ = hub_kwargs.pop("code_revision", None)
360 # This block handles the case where the user is loading a model with trust_remote_code=True
361 # but a library model exists with the same name. We don't want to override the autoclass
362 # mappings in this case, or all future loads of that model will be the remote code model.

File /opt/homebrew/lib/python3.14/site-packages/transformers/dynamic_module_utils.py:583, in get_class_from_dynamic_module(class_reference, pretrained_model_name_or_path, cache_dir, force_download, proxies, token, revision, local_files_only, repo_type, code_revision, **kwargs)
571 # And lastly we get the class inside our newly created module
572 final_module = get_cached_module_file(
573 repo_id,
574 module_file + ".py",
(...) 581 repo_type=repo_type,
582 )
--> 583 return get_class_in_module(class_name, final_module, force_reload=force_download)
...
---> 21 from transformers.utils.generic import OutputRecorder, check_model_inputs
23 try:
24 from fla.modules import FusedRMSNormGated, ShortConvolution

ImportError: cannot import name 'OutputRecorder' from 'transformers.utils.generic' (/opt/homebrew/lib/python3.14/site-packages/transformers/utils/generic.py)

sjlee1234 changed discussion title from Non-existant API Call - Request for Update to Non-existant API Call - Request for Help
sjlee1234 changed discussion status to closed

Sign up or log in to comment