code: def test_start_invoke_destroy_local_triton_server_gpu(
      self, mock_importlib
  ):
      mock_triton_client = Mock()
      mock_importlib.import_module.side_effect = (
          lambda module_name: mock_triton_client
          if module_name == "tritonclient.http"
          else None
      )
  
      mock_container = Mock()
      mock_docker_client = Mock()
      mock_docker_client.containers.run.return_value = mock_container
  
      # Launch container in GPU mode
  
      local_triton_server = LocalTritonServer()
      mock_schema_builder = Mock()
      mock_schema_builder.input_serializer.serialize.return_value = (
          PAYLOAD
      )
      mock_schema_builder._input_triton_dtype = DTYPE
      mock_schema_builder._output_triton_dtype = DTYPE
      local_triton_server.schema_builder = mock_schema_builder
  
      local_triton_server._start_triton_server(
          docker_client=mock_docker_client,
          model_path=MODEL_PATH,
          secret_key=SECRET_KEY,
          image_uri=GPU_TRITON_IMAGE,
          env_vars=ENV_VAR,
      )
  
      mock_docker_client.containers.run.assert_called_once_with(
          image=GPU_TRITON_IMAGE,
          command=["tritonserver", "--model-repository=/models"],
          shm_size=_SHM_SIZE,
          device_requests=[
              DeviceRequest(count=-1, capabilities=[["gpu"]])
          ],
          network_mode="host",
          detach=True,
          auto_remove=True,
          volumes={MODEL_REPO: {"bind": "/models", "mode": "rw"}},
          environment=ENV_VAR,
      )
  
      # Try to ping container
      mock_client = Mock()
      mock_response = Mock()
      mock_client.infer.return_value = mock_response
      mock_response.get_response.return_value = INFER_RESPONSE
      mock_triton_client.InferenceServerClient.return_value = (
          mock_client
      )
  
      mock_request = Mock()
      mock_triton_client.InferInput.return_value = mock_request
  
      local_triton_server._invoke_triton_server(payload=PAYLOAD)
  
      mock_triton_client.InferenceServerClient.assert_called_once_with(
          url="localhost:8000"
      )
      mock_triton_client.InferInput.assert_called_once_with(
          "input_1", PAYLOAD.shape, datatype="FP32"
      )
      mock_request.set_data_from_numpy.assert_called_once_with(
          PAYLOAD, binary_data=True
      )
      mock_client.infer.assert_called_with(
          model_name="model", inputs=[mock_request]
      )
  
file_path: sagemaker-python-sdk/tests/unit/sagemaker/serve/model_server/triton/test_server.py
imports: from __future__ import absolute_import
  from unittest import TestCase
  from unittest.mock import Mock, patch, ANY
  import numpy
  from docker.types import DeviceRequest
  from sagemaker.serve.model_server.triton.server import LocalTritonServer, SageMakerTritonServer
label_desc: Use image node_id 1 for calling the TritonServerTests obj's underlying member method code with example usage: obj.test_start_invoke_destroy_local_triton_server_gpu(mock_importlib) without return types