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

How to Run With Polygraphy Graph Surgeon #121

Open
sam-h-bean opened this issue Aug 7, 2022 · 5 comments
Open

How to Run With Polygraphy Graph Surgeon #121

sam-h-bean opened this issue Aug 7, 2022 · 5 comments

Comments

@sam-h-bean
Copy link

Hey I love your repo and want to use it but because my model does not work with TRT out of the box I need to run the Polygraphy Graph Surgeon to Sanitize before converting.

I don't see a way to run your entrypoint for this use case. Basically I want to export to ONNX, then run the sanitize CLI, then use that ONNX model with your code. I have a fork where I'm just removing the convert to ONNX step as a hack but am wondering how we might support this use case natively in the repo.

@pommedeterresautee
Copy link
Member

Thank you @sam-h-bean. For the sanitization we have just implemented onnxoptimizer which is called during the onnx export:

def clean_graph(proto: onnx.ModelProto) -> onnx.ModelProto:

Would it work for you?

@sam-h-bean
Copy link
Author

@pommedeterresautee I'm not sure, I need to run the following command to make it work with TRT.

export POLYGRAPHY_AUTOINSTALL_DEPS=1
polygraphy surgeon sanitize ./model.onnx --fold-constants --output model-folded.onnx --save-external-data

I'm not sure if this functionality is covered by your clean graph method

@sam-h-bean
Copy link
Author

@pommedeterresautee I tried doing it this way and still ran into the following

[08/09/2022-01:08:34] [TRT] [E] 2: [builder.cpp::buildSerializedNetwork::636] Error Code 2: Internal Error (Assertion engine != nullptr failed. )

@pommedeterresautee
Copy link
Member

can you let me know which model it is?

@sam-h-bean
Copy link
Author

sam-h-bean commented Aug 9, 2022

Codegen-16B-multi

We've had issues with it with other tools as well such as pytorch-tensorrt

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