Describe the bug
The patch doesn't work now because the function signature for from_pretrained changed in Transformers v4.50 with huggingface/transformers#36033
Steps/Code to reproduce bug
Import modelopt.torch.opt.plugins.huggingface, and then try to load a pretrained model from transformer.
We get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/envs/pytorch/lib/python3.11/site-packages/modelopt/torch/opt/plugins/huggingface.py", line 84, in _new_from_pretrained
model = types.MethodType(cls._modelopt_cache["from_pretrained"].__func__, cls)(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/pytorch/lib/python3.11/site-packages/transformers/modeling_utils.py", line 272, in _wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/envs/pytorch/lib/python3.11/site-packages/transformers/modeling_utils.py", line 4455, in from_pretrained
) = cls._load_pretrained_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _new__load_pretrained_model() missing 1 required positional argument: 'pretrained_model_name_or_path'
Expected behavior
It should work.
Describe the bug
The patch doesn't work now because the function signature for from_pretrained changed in Transformers v4.50 with huggingface/transformers#36033
Steps/Code to reproduce bug
Import modelopt.torch.opt.plugins.huggingface, and then try to load a pretrained model from transformer.
We get the following error:
Expected behavior
It should work.