jina.executors.encoders.tfserving

class jina.executors.encoders.tfserving.BaseTFServingClientEncoder(model_name, signature_name='serving_default', method_name='Predict', *args, **kwargs)[source]

Bases: jina.executors.clients.BaseTFServingClientExecutor, jina.executors.encoders.BaseEncoder

BaseTFServingEncoder is the base class for the encoders that wrap up a tf serving client. The client call

the gRPC port of the tf server.

Parameters
  • model_name (str) – the name of the tf serving model. It must match the MODEL_NAME parameter when starting the tf server.

  • signature_name (str) – the name of the tf serving signature. It must match the key in the signature_def_map when exporting the tf serving model.

  • method_name (str) –

    the name of the tf serving method. This parameter corresponds to the method_name parameter

    when building the signature map with build_signature_def(). Currently, only Predict is supported.

    The other methods including Classify, Regression needs users to implement the _fill_classify_request and _fill_regression_request, correspondingly. For the details of signature_defs, please refer to https://www.tensorflow.org/tfx/serving/signature_defs.

encode(data, *args, **kwargs)[source]
Return type

Any

class jina.executors.encoders.tfserving.UnaryTFServingClientEncoder(input_name, output_name, *args, **kwargs)[source]

Bases: jina.executors.encoders.tfserving.BaseTFServingClientEncoder

UnaryTFServingEncoder is an encoder that wraps up a tf serving client. This client covers the simplest

case, in which both the request and the response have a single data field.

Parameters
  • input_name (str) – the name of data field in the request

  • output_name (str) – the name of data field in the response

get_input(data)[source]

Convert the input data into a dict with the models input feature names as the keys and the input tensors as the values.

get_output(response)[source]

Postprocess the response from the tf server