X-PLUG / mPLUG-Owl

mPLUG-Owl: The Powerful Multi-modal Large Language Model Family
https://www.modelscope.cn/studios/damo/mPLUG-Owl
MIT License
2.25k stars 171 forks source link

TypeError in loading the model #132

Closed srivivtcs closed 1 year ago

srivivtcs commented 1 year ago

Hi, I am trying to load the model in HuggingFace style. The following line in the code is giving the error:

model = MplugOwlForConditionalGeneration.from_pretrained( pretrained_ckpt, torch_dtype=torch.bfloat16, )

The error I am getting is: TypeError: Object of type method is not JSON serializable

I have tried loading the model from a local repository as well. But no luck so far.

MAGAer13 commented 1 year ago

One things you can try is to install the transformer package with version 4.29.0. It may help.

srivivtcs commented 1 year ago

It worked, thanks!

admk commented 11 months ago

How I can I get it to work in 4.34.1? I have other models in the same project that can only work with recent versions of transformers.

18445864529 commented 11 months ago

How I can I get it to work in 4.34.1? I have other models in the same project that can only work with recent versions of transformers.

when hf tries to get string representations of the model, there's a module that cannot be converted to string. The fastest but dirty way is to modify the source code of hf where gives u the error, adding a try-except. If the module cannot be stringtized just set it to a certain string instead.

admk commented 11 months ago

Thanks, I used

from mplug_owl.configuration_mplug_owl import MplugOwlConfig

MplugOwlConfig.to_json_string = lambda *args, **kwargs: ''

as a temporary hack for loading.