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

Layoutlmv2 Prediction/Inference from fine tuned .pth model #231

Open
nikithakriz opened this issue Jan 3, 2023 · 0 comments
Open

Layoutlmv2 Prediction/Inference from fine tuned .pth model #231

nikithakriz opened this issue Jan 3, 2023 · 0 comments

Comments

@nikithakriz
Copy link

nikithakriz commented Jan 3, 2023

Hai,

I have finetuned layoutlmv2 model using custom dataset which was annotated in FUNSD format. Now i can save my finetuned model in local(.pth) using torch.save. Now i need to get predictions using finetuned (.pth) state dict. Am beginner to this anyone know how to get predictions. .pth has state dict which is weights and biasis.

I tried to get predictions using:
**state_dict = torch.load("/content/model_17.pth")

Create the model and tokenizer using the state dictionary

model = LayoutLMv2ForTokenClassification.from_pretrained("/config.json",state_dict=state_dict, ignore_mismatched_sizes=True)**

but getting weird prediction output. Anybody knew solution for this?
Thanks in advance!

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

1 participant