Esempio n. 1
0
def _create_model_server_runner(
    model_path: Text,
    serving_binary: serving_bins.ServingBinary,
    serving_spec: infra_validator_pb2.ServingSpec):
  """Create a ModelServerRunner from a model, a ServingBinary and a ServingSpec.

  Args:
    model_path: An IV-flavored model path. (See model_path_utils.py)
    serving_binary: One of ServingBinary instances parsed from the
        `serving_spec`.
    serving_spec: A ServingSpec instance of this infra validation.

  Returns:
    A ModelServerRunner.
  """
  platform = serving_spec.WhichOneof('serving_platform')
  if platform == 'local_docker':
    return local_docker_runner.LocalDockerRunner(
        model_path=model_path,
        serving_binary=serving_binary,
        serving_spec=serving_spec
    )
  elif platform == 'kubernetes':
    return kubernetes_runner.KubernetesRunner(
        model_path=model_path,
        serving_binary=serving_binary,
        serving_spec=serving_spec
    )
  else:
    raise NotImplementedError('Invalid serving_platform {}'.format(platform))
Esempio n. 2
0
def _create_model_server_runner(model: types.Artifact,
                                serving_binary: serving_bins.ServingBinary,
                                serving_spec: infra_validator_pb2.ServingSpec):
    """Create a ModelServerRunner from a model, a ServingBinary and a ServingSpec.

  Args:
    model: Model artifact that will be infra validated.
    serving_binary: One of ServingBinary instances parsed from the
        `serving_spec`.
    serving_spec: A ServingSpec instance of this infra validation.

  Returns:
    A ModelServerRunner.
  """
    platform = serving_spec.WhichOneof('serving_platform')
    if platform == 'local_docker':
        return local_docker_runner.LocalDockerRunner(
            model=model,
            serving_binary=serving_binary,
            serving_spec=serving_spec)
    else:
        raise NotImplementedError(
            'Invalid serving_platform {}'.format(platform))
Esempio n. 3
0
 def _CreateLocalDockerRunner(self):
     return local_docker_runner.LocalDockerRunner(
         model_path=self._model_path,
         serving_binary=self._serving_binary,
         serving_spec=self._serving_spec)