-
Notifications
You must be signed in to change notification settings - Fork 883
Add support for torch exported model #2812
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now there is no reason to just export a model, you want to combine this with an aot inductor tutorial so people can get ahead of time compilation and avoid cold starts
@@ -0,0 +1,62 @@ | |||
# TorchServe inference with torch export model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there were some export related details on the main README as well could you consolidate?
|
||
- `PyTorch >= 2.1.0` | ||
|
||
Change directory to the root of `serve` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cd serve is simpler
`torch.export.export()` takes a `torch.nn.Module` or a method along with sample inputs, and captures the computation graph into an `torch.export.ExportedProgram` | ||
|
||
`torch.export` differs from `torch.compile` is a few ways | ||
- JIT vs AOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs a longer elaboration
### Create model archive | ||
|
||
``` | ||
torch-model-archiver --model-name res18-pt2 --handler image_classifier --version 1.0 --serialized-file resnet18.pt2 --extra-files ./examples/image_classifier/index_to_name.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to update the archiver code docstrings as well
|
||
`torch.export.export()` takes a `torch.nn.Module` or a method along with sample inputs, and captures the computation graph into an `torch.export.ExportedProgram` | ||
|
||
`torch.export` differs from `torch.compile` is a few ways |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to combo aot inductor with this story
torch.export.export by itself only creates an FX Graph representation of the model and serializes it. So, at inference, the model is executed in eager. Hence, even though this works, closing this PR as it doesn't make use of torch.compile |
Description
This PR adds support for
Fixes #(issue)
Type of change
Please delete options that are not relevant.
Feature/Issue validation/testing
Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.
Checklist: