Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDOP FUNSD , not able to perform Inference #401

Open
fathyshalaby opened this issue Mar 21, 2024 · 2 comments
Open

UDOP FUNSD , not able to perform Inference #401

fathyshalaby opened this issue Mar 21, 2024 · 2 comments

Comments

@fathyshalaby
Copy link

Hey @NielsRogge ,

I just tried to follow your tutorial: https://github.com/NielsRogge/Transformers-Tutorials/blob/master/UDOP/Fine_tune_UDOPEncoderModel_on_FUNSD_(HuggingFace_Trainer).ipynb

and I trained the model but when i try to execute the inference i portion of the notebook i get:

ValueError: Unrecognized configuration class <class 'transformers.models.udop.configuration_udop.UdopConfig'> for this kind of AutoModel: AutoModelForTokenClassification.
Model type should be one of AlbertConfig, BertConfig, BigBirdConfig, BioGptConfig, BloomConfig, BrosConfig, CamembertConfig, CanineConfig, ConvBertConfig, Data2VecTextConfig, DebertaConfig, DebertaV2Config, DistilBertConfig, ElectraConfig, ErnieConfig, ErnieMConfig, EsmConfig, FalconConfig, FlaubertConfig, FNetConfig, FunnelConfig, GPT2Config, GPT2Config, GPTBigCodeConfig, GPTNeoConfig, GPTNeoXConfig, IBertConfig, LayoutLMConfig, LayoutLMv2Config, LayoutLMv3Config, LiltConfig, LongformerConfig, LukeConfig, MarkupLMConfig, MegaConfig, MegatronBertConfig, MobileBertConfig, MPNetConfig, MptConfig, MraConfig, MT5Config, NezhaConfig, NystromformerConfig, PhiConfig, QDQBertConfig, RemBertConfig, RobertaConfig, RobertaPreLayerNormConfig, RoCBertConfig, RoFormerConfig, SqueezeBertConfig, T5Config, UMT5Config, XLMConfig, XLMRobertaConfig, XLMRobertaXLConfig, XLNetConfig, XmodConfig, YosoConfig.

I'm also using the newest version of transformers from source.

Would really appreciate your help, as I would love to use it for my projects.

@fathyshalaby
Copy link
Author

I see that this is probably a problem from transformers side as you already have a UdopForTokenClassification class in the notebook, would maybe change the line with the AutoModelForTokenClassification with model instead or just call the class itself.

@NielsRogge
Copy link
Owner

Hi,

As we defined a custom class (UdopForTokenClassification), you would need to use this class to perform inference. Hence you can just do:

from transformers import UdopForTokenClassification

model = UdopForTokenClassification.from_pretrained("path_to_directory")

and proceed as explained in the notebook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants