MLServer
MLServer copied to clipboard
Unable to use `tritonclient.grpc`
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
.
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.
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).
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.
@lc525 hey, have you had an opportunity to look into this?