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

feat: add generic protobuf #2634

Merged
merged 9 commits into from Jun 28, 2022
Merged

feat: add generic protobuf #2634

merged 9 commits into from Jun 28, 2022

Conversation

Proto007
Copy link
Contributor

@Proto007 Proto007 commented Jun 23, 2022

Description

Added a generic protobuf file to represent arrays in protobuf format for grpc. Currently contains message Value to represent single instance of supported types, message Array to represent arrays of supported types, and message NumpyNdarray which stores more details about the arrays similar to python numpy arrays.

Motivation and Context

This is a step towards allowing serving through grpc.

How Has This Been Tested?

This has been tested by creating protobuf instances of different types of arrays using the generated code of this proto file.

Checklist:

  • My code follows the bentoml code style, both make format and
    make lint script have passed
    (instructions).
  • My change reduces project test coverage and requires unit tests to be added
  • I have added unit tests covering my code change
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link
Member

@aarnphm aarnphm left a comment

Choose a reason for hiding this comment

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

overall looks good to me. Lets proceed with the next step from the meeting.

* The repeated field for the identified dtype contains the array.
* Naming convention: Follows `numpy.dtype` where appropriate.
* `numpy.dtype`: https://numpy.org/doc/stable/reference/arrays.dtypes.html#specifying-and-constructing-data-types */
message Array {
Copy link
Member

@aarnphm aarnphm Jun 25, 2022

Choose a reason for hiding this comment

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

Suggested change
message Array {
message NumpyNdarray {

Also i think the filename should be protos/io_descriptors/numpy.proto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the message name, I thought we were keeping it Array to prevent confusion from clients using languages other than python. If I separate all the io descriptors in their own proto, there will be one generated file for each proto. Having one io_descriptor proto means users can access them from one generated file. For example: io_descriptor_pb.Array() to create a new array and io_descriptor_pb.PandasDataframe() to create a pandas dataframe and so on.

Copy link
Member

Choose a reason for hiding this comment

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

I think NumpyNdarray provides a better distinction than normal Array. Since a lot of the proto message is Numpy specific, thus the name NumpyNdarray makes it more clear than just Array.

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't do this in JSON, and I'm not sure we want to do this here. Numpy is what's being used in the server under the hood to process generic array data coming from clients, I don't think clients should care what the input format is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made the change to NumpyNdarray. If you guys want, I can change it back to Array

Copy link
Member

Choose a reason for hiding this comment

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

@sauyon imo we should follow the naming in io_descriptors for consistency

Copy link
Contributor

@sauyon sauyon left a comment

Choose a reason for hiding this comment

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

Should we merge this now so you can start working on the I/O descriptors, or do you want to finish up the TODOs first?

protos/io_descriptors.proto Outdated Show resolved Hide resolved
@aarnphm
Copy link
Member

aarnphm commented Jun 28, 2022

Should we merge this now so you can start working on the I/O descriptors, or do you want to finish up the TODOs first?

Lets merge this sauyon

@aarnphm
Copy link
Member

aarnphm commented Jun 28, 2022

@Proto007 me and @sauyon discuss offline. We will merge this one in. Continue with your PR for numpy ! Great job.

@aarnphm aarnphm merged commit fd808ad into bentoml:grpc Jun 28, 2022
@Proto007 Proto007 deleted the generic-protobuf branch June 28, 2022 18:59
aarnphm pushed a commit that referenced this pull request Jun 29, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Jun 29, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Jun 29, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Jun 29, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Jul 7, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Jul 12, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Jul 14, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Jul 17, 2022
* Added generic proto file with basic Value message

* Added basic Array message to represent arrays

* Added Tuple message to represent tuples

* Added timestamp and duration datatypes

* Added concise todo comments

* Changed field names, message name `NumpyNdarray`

* Applied changed message name, moved todo comment

* Added trailing newline

* Fixed sint32 and sint64 field names

Co-authored-by: Sadab Hafiz <sadabhafizny@gmail.com>
Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 13, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 14, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 15, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 16, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 16, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 16, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 16, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 16, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
aarnphm pushed a commit that referenced this pull request Sep 16, 2022
See #2634 and #2742.

Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

None yet

3 participants