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

Unable to use tritonclient.grpc #1730

Open
tokoko opened this issue May 2, 2024 · 4 comments
Open

Unable to use tritonclient.grpc #1730

tokoko opened this issue May 2, 2024 · 4 comments

Comments

@tokoko
Copy link

tokoko commented May 2, 2024

I'm trying to use tritonclient.grpc inside an mlserver model, but looks like they don't really go well with one another. python -c "import mlserver;import tritonclient.grpc" results in a Couldn't build proto file into descriptor pool: duplicate symbol 'inference.ServerLiveRequest' . I'm not a protobuf expert, but seems like both mlserver and tritonclient have protobuf-generated classes from identical (or maybe just similar?) OIP protos and they conflict with one another. Is there any way to work around this? For example, is it realistic for mlserver to use proto classes from tritonclient directly since it's a required dependency anyway?

I think another simpler solution might be changing package declaration in dataplane.proto from inference to something like inference_mlserver.

@tokoko
Copy link
Author

tokoko commented May 2, 2024

As far as I could tell, the one thing that package name change would affect is Prometheus metrics, package name is part of a key in metrics, I think.

@lc525
Copy link
Member

lc525 commented May 2, 2024

Both mlserver and tritonclient.grpc declare a submodule called inference. This leads to the duplicate symbol, which should be solvable through typical means (more specific imports, import ... as, etc).

@tokoko
Copy link
Author

tokoko commented May 2, 2024

Hey, thanks for the response. Unfortunately, I don't think it's that simple. The error happens even with top-level imports, I'm not trying to import anything message related specifically. For example running python -c "import tritonclient.grpc; import mlserver" leads to an error with the following stack trace:

File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/mlserver/__init__.py", line 2, in <module>
    from .server import MLServer
  File "/usr/local/lib/python3.9/site-packages/mlserver/server.py", line 17, in <module>
    from .grpc import GRPCServer
  File "/usr/local/lib/python3.9/site-packages/mlserver/grpc/__init__.py", line 1, in <module>
    from .server import GRPCServer
  File "/usr/local/lib/python3.9/site-packages/mlserver/grpc/server.py", line 9, in <module>
    from .servicers import InferenceServicer
  File "/usr/local/lib/python3.9/site-packages/mlserver/grpc/servicers.py", line 3, in <module>
    from . import dataplane_pb2 as pb
  File "/usr/local/lib/python3.9/site-packages/mlserver/grpc/dataplane_pb2.py", line 16, in <module>
    DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
TypeError: Couldn't build proto file into descriptor pool: duplicate symbol 'inference.ServerLiveRequest'

I'm not exactly sure what this method (_descriptor_pool.Default().AddSerializedFile) does, but looks like it's registering symbols in some global namespace, which can't really be remedied with a simple import ... as ... statement, symbols are hardcoded in both libraries.

@tokoko
Copy link
Author

tokoko commented May 8, 2024

@lc525 hey, have you had an opportunity to look into this?

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