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

Support calling custom method names on PyTorch module #99

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iceychris
Copy link
Contributor

@iceychris iceychris commented Apr 8, 2023

  • basic support
  • test with dict inputs
  • test with list inputs
  • test default method name ("forward")
  • test custom method name
  • format

@iceychris iceychris force-pushed the feature/support-custom-method-names branch from 75f87cd to 019793a Compare April 8, 2023 18:33
@iceychris iceychris marked this pull request as ready for review April 8, 2023 18:34
@iceychris iceychris force-pushed the feature/support-custom-method-names branch 3 times, most recently from dbecc04 to 40b305b Compare April 8, 2023 19:47
Copy link

@Legion2 Legion2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, what is missing for it to be mergeable?

README.md Outdated Show resolved Hide resolved
src/libtorch.cc Outdated Show resolved Hide resolved
src/libtorch.cc Outdated Show resolved Hide resolved
src/libtorch.cc Show resolved Hide resolved
src/libtorch_utils.cc Outdated Show resolved Hide resolved
@iceychris iceychris force-pushed the feature/support-custom-method-names branch from 40b305b to c6a9e1c Compare April 11, 2023 10:49
@iceychris
Copy link
Contributor Author

@dyastremsky @tanmayv25 Mind looking into this? This PR should be ready.

I tested locally by building & running tritonserver with the modified backend code (list/dict inputs, new flag present/not present in config).

@iceychris iceychris requested a review from Legion2 April 11, 2023 11:00
Legion2
Legion2 previously approved these changes Apr 11, 2023
Copy link

@Legion2 Legion2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dyastremsky
Copy link
Contributor

dyastremsky commented Apr 11, 2023

Thanks for submitting this PR and tagging us, Christian! We'll need a Contributor License Agreement (CLA) here to merge these changes. You can see how to submit it here. That's also got directions on formatting this code to be aligned with the rest of the repo.

In addition to reviewing your ticket, the other thing we'll need to look into once we get your CLA is adding tests. We appreciate you manually testing, we do need automated tests to ensure this passes and doesn't break in the future. You can see how this is done in the server qa folder here. The model generation is done in the qa's common folder. If you're unable to add the tests, we may be able to do so, though then we'll need time to get to this ticket.

@tanmayv25
Copy link
Contributor

@iceychris Thanks for your contribution! We are still waiting from the signed CLA from you to proceed with it further. Please let me know once it is completed. I can work on adding test cases for this on our CI if you'd like.

src/libtorch.cc Outdated
@@ -764,7 +799,8 @@ ModelInstanceState::ValidateInputs(const size_t expected_input_cnt)
// configuration specifies only those.
std::vector<std::string> allowed_inputs;

const torch::jit::Method& method = torch_model_->get_method("forward");
const torch::jit::Method& method =
Copy link
Contributor

@tanmayv25 tanmayv25 Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add error checking here for case the model_state_->ModuleMethodName() is not available in the model.
Otherwise the server will see a core dump..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iceychris Did you get a chance to add the exception handling? I can take over if you don't mind?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet, I'm currently busy, so feel free to go ahead 👍🏾

@lifeiteng
Copy link

@iceychris Can you let this PR finish merging? This is a very important feature.

@iceychris iceychris force-pushed the feature/support-custom-method-names branch from 6c0b463 to e4cc7a6 Compare January 29, 2024 15:12
@iceychris iceychris force-pushed the feature/support-custom-method-names branch from e4cc7a6 to 11fb866 Compare January 29, 2024 16:20
@iceychris
Copy link
Contributor Author

iceychris commented Jan 29, 2024

@tanmayv25 I signed the CLA along with the commit and rebased onto main.
Haven't had a chance to look into setting up proper testing though. Can you take it from here?

@tanmayv25 tanmayv25 self-requested a review May 2, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants