0

I had two 2 docker container in the server. One is Triton Client Server whose GRPC port I set is 1747. Triton Client Server port had a TorchScript model running on it. The other container is where I want to call grpcclient.InferenceServerClient to the Triton container but I got the error:

Traceback (most recent call last):
  File "/home/user/miniconda/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/home/user/miniconda/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/miniconda/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/user/miniconda/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/miniconda/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/user/miniconda/lib/python3.8/site-packages/uvicorn/main.py", line 404, in main
    run(
  File "/home/user/miniconda/lib/python3.8/site-packages/uvicorn/main.py", line 569, in run
    server.run()
  File "/home/user/miniconda/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/home/user/miniconda/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/home/user/miniconda/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/user/miniconda/lib/python3.8/site-packages/uvicorn/server.py", line 67, in serve
    config.load()
  File "/home/user/miniconda/lib/python3.8/site-packages/uvicorn/config.py", line 477, in load
    self.loaded_app = import_from_string(self.app)
  File "/home/user/miniconda/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/home/user/miniconda/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./api_control.py", line 5, in <module>
    import helpers 
  File "./helpers.py", line 79, in <module>
    timi_triton = TritonInferTTS(url=TRITON_URL,model_name=TIMI_MODEL_NAME,model_version=TIMI_MODEL_VERSION)
  File "./triton_client.py", line 22, in __init__
    self.triton_client = grpcclient.InferenceServerClient(url=self.url, verbose=VERBOSE)
  File "/home/user/miniconda/lib/python3.8/site-packages/tritonclient/grpc/__init__.py", line 273, in __init__
    self._channel = grpc.insecure_channel(url, options=channel_opt)
  File "/home/user/miniconda/lib/python3.8/site-packages/grpc/__init__.py", line 1977, in insecure_channel
    return _channel.Channel(target, () if options is None else options, None,
  File "/home/user/miniconda/lib/python3.8/site-packages/grpc/_channel.py", line 1479, in __init__
    _common.encode(target), _augment_options(core_options, compression),
  File "/home/user/miniconda/lib/python3.8/site-packages/grpc/_common.py", line 74, in encode
    return s.encode('utf8')
AttributeError: 'NoneType' object has no attribute 'encode'
Exception ignored in: <function InferenceServerClient.__del__ at 0x7f41eb398550>
Traceback (most recent call last):
  File "/home/user/miniconda/lib/python3.8/site-packages/tritonclient/grpc/__init__.py", line 286, in __del__
  File "/home/user/miniconda/lib/python3.8/site-packages/tritonclient/grpc/__init__.py", line 293, in close
  File "/home/user/miniconda/lib/python3.8/site-packages/tritonclient/grpc/__init__.py", line 1649, in stop_stream
AttributeError: 'InferenceServerClient' object has no attribute '_stream'

Here is the code:

import os
import numpy as np

import sys

from functools import partial
import tritonclient.grpc as grpcclient
from tritonclient.utils import *
VERBOSE = False
TRITON_URL = 'localhost:1747'
TIMI_MODEL_NAME = os.getenv("TIMI_MODEL_NAME")
TIMI_MODEL_VERSION = os.getenv('TIMI_MODEL_VERSION')

class TritonInferTTS():
    def __init__(self, url, model_name, model_version):
        self.url = url
        self.model_name = model_name
        self.model_version = model_version

        self.input_name = ['INPUT__0', 'INPUT__1','INPUT__2','INPUT__3','INPUT__4']
        self.output_name = ['OUTPUT__0']
        self.triton_client = grpcclient.InferenceServerClient(url=self.url, verbose=VERBOSE)
        model_metadata = self.triton_client.get_model_metadata(model_name=self.model_name, model_version=self.model_version)
        model_config = self.triton_client.get_model_config(model_name=self.model_name, model_version=self.model_version)

    
    def triton_infer_grpc(self, x, x_length,noise_scale,length_scale,noise_scale_w):
        # x = np.array([x])

        # alpha = np.array([alpha], dtype=np.float32)

        input0 = InferInput(self.input_name[0], x.shape, 'INT64')
        input0 = x

        input1 = InferInput(self.input_name[1], x_length.shape, 'INT64')
        input1 = x_length
        input2 = InferInput(self.input_name[2], noise_scale.shape, 'FP32')
        input2 = noise_scale
        input3 = InferInput(self.input_name[3], length_scale.shape, 'FP32')
        input3 = length_scale
        input4 = InferInput(self.input_name[4], noise_scale_w.shape, 'FP32')
        input4 = noise_scale_w

        output0 = grpcclient.ssInferRequestedOutput(self.output_name[0])
        # output1 = InferRequestedOutput(self.output_name[1])
        
        response = self.triton_client.infer(self.model_name, model_version=self.model_version, inputs=[input0, input1,input2,input3,input4], outputs=[output0])
        audio = response[0]

        return audio

Please help me. I'm so desperate

I changed the Triton Url to 'host.docker.internal:1747' and '<my_public_ip>:1747' but i got the same error

2
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Feb 20, 2023 at 20:22
  • Have a look here: stackoverflow.com/questions/75765328/… Commented Mar 17, 2023 at 23:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.