Skip to content

how to perform quantization of my onnx or pytorch model. #3570

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

Open
WilliamZhaoz opened this issue Sep 29, 2019 · 6 comments
Open

how to perform quantization of my onnx or pytorch model. #3570

WilliamZhaoz opened this issue Sep 29, 2019 · 6 comments
Labels
onnx ONNX support related issues

Comments

@WilliamZhaoz
Copy link

now I have my own pytorch and onnx model.
how can I quantize it using glow in python API, and then how can I inference it in glow?
is there any clear doc?
thanks.

@jackm321
Copy link
Contributor

jackm321 commented Oct 1, 2019

Hi @WilliamZhaoz, for onnx models you should be able to use the Loader or any of the example binaries that use the Loader (see this doc)

For PyTorch models, this isn't currently available in torch_glow, but we have plans to add this feature. If you are interested in implementing it please go for it otherwise I will probably be able to do it next week.

@WilliamZhaoz
Copy link
Author

WilliamZhaoz commented Oct 3, 2019 via email

@jackm321
Copy link
Contributor

@WilliamZhaoz apologies for the delayed response.
You should be able to use ImageClassifier or TextTranslator as an example for using Loader to load a model from file and run it.

@WilliamZhaoz
Copy link
Author

WilliamZhaoz commented Oct 22, 2019 via email

@jackm321
Copy link
Contributor

I'm not sure exactly what you mean.

What I meant was that probably you can make a binary similar to ImageClassifier or TextTranslator for your task and probably even can reuse Loader.cpp to create the glow graph for you.

@opti-mix opti-mix added the onnx ONNX support related issues label Jan 22, 2020
@ponnamsairam
Copy link

thanks Jack, I have a onnx model, converted from pytorch model, but my task is not a image classification task, in such a situation, how can I perform my model, since I find only a image classification interface in glow. Jack Montgomery [email protected] 于2019年10月1日周二 下午5:58写道:

Hi @WilliamZhaoz https://github.com/WilliamZhaoz, for onnx models you should be able to use the Loader or any of the example binaries that use the Loader (see this doc https://github.com/pytorch/glow/blob/master/docs/Quantization.md#how-to-perform-nn-conversion ) For PyTorch models, this isn't currently available in torch_glow, but we have plans to add this feature. If you are interested in implementing it please go for it otherwise I will probably be able to do it next week. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#3570?email_source=notifications&email_token=AIWSN2O4US55V5VRFOKUXO3QMMNLJA5CNFSM4I3RILKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAAWRRI#issuecomment-536963269>, or mute the thread https://github.com/notifications/unsubscribe-auth/AIWSN2MAM725LPUGCTWTFT3QMMNLJANCNFSM4I3RILKA .

@WilliamZhaoz You need to generate bundles using model-compiler using that .onnx model after that you can run the bundle using main.cpp API
for reference please go through AOT.md in docs
#3939 --go through this link.

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

No branches or pull requests

4 participants