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

PEGASUS using ONNX #12573

Closed
karimfayed opened this issue Jul 8, 2021 · 3 comments
Closed

PEGASUS using ONNX #12573

karimfayed opened this issue Jul 8, 2021 · 3 comments

Comments

@karimfayed
Copy link

Hello @patrickvonplaten. , I just uploaded my fine-tuned model to the hub and I wanted to use ONNX to convert the pytorch model and be able to use it in a JavaScript back-end.
I used the following command:
!python3 -m transformers.convert_graph_to_onnx --model Karimfayed/pegasus-SAMSum --framework pt pegasus-SAMSum.onnx
I receive the following error message:

Error while converting the model: Unrecognized configuration class <class 'transformers.configuration_pegasus.PegasusConfig'> for this kind of AutoModel: AutoModel.
Model type should be one of RetriBertConfig, T5Config, DistilBertConfig, AlbertConfig, CamembertConfig, XLMRobertaConfig, BartConfig, LongformerConfig, RobertaConfig, LayoutLMConfig, SqueezeBertConfig, BertConfig, OpenAIGPTConfig, GPT2Config, MobileBertConfig, TransfoXLConfig, XLNetConfig, FlaubertConfig, FSMTConfig, XLMConfig, CTRLConfig, ElectraConfig, ReformerConfig, FunnelConfig, LxmertConfig, BertGenerationConfig, DebertaConfig, DPRConfig, XLMProphetNetConfig, ProphetNetConfig.

Is PEGASUS going to be added to the list soon or is there any way around it?

@LysandreJik
Copy link
Member

Hello @karimfayed! We're in the process of switching our approach relative to using the ONNX converter. See the following PR #11786.

It has support for BART, so enabling support for Pegasus should be fairly simple. Please let us know if you run into any issues.

You can see the docs here: https://235542-155220641-gh.circle-artifacts.com/0/docs/_build/html/serialization.html

Please make sure to git checkout the PR first!

@karimfayed
Copy link
Author

Hello @karimfayed! We're in the process of switching our approach relative to using the ONNX converter. See the following PR #11786.

It has support for BART, so enabling support for Pegasus should be fairly simple. Please let us know if you run into any issues.

You can see the docs here: https://235542-155220641-gh.circle-artifacts.com/0/docs/_build/html/serialization.html

Please make sure to git checkout the PR first!

Hello @LysandreJik , thank you for your help. I read both the docs and the issue and I used the command :
!python3 -m transformers.onnx -f pytorch --model=Karimfayed/pegasus-SAMSum --features=default --optimize --optimization-level=all onnx/Karimfayed/pegasus-SAMSum/

but I keep getting this error

/usr/bin/python3: No module named transformers.onnx

Even when I replace transformers.onnx with transformers.onnx.export I get this error:

/usr/bin/python3: Error while finding module specification for 'transformers.onnx.export' (ModuleNotFoundError: No module named 'transformers.onnx')

@github-actions
Copy link

github-actions bot commented Aug 7, 2021

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

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