I am implementing a tfx pipeline, similar to the chicago taxi example
The prediction of the pushed model returns {"predictions": []}
.
How do I debug this issue?
I can see logs of the predictions being made. But because it returns an empty array the status code is 200 and there is no usefull information on what went wrong. I expect the prediction request data isn't passed correctly to the estimator.
The chicago example uses this as their serving receiver and that works. I assume it should also work for my example
def _example_serving_receiver_fn(transform_output, schema):
"""Build the serving in inputs.
Args:
transform_output: directory in which the tf-transform model was written
during the preprocessing step.
schema: the schema of the input data.
Returns:
Tensorflow graph which parses examples, applying tf-transform to them.
"""
raw_feature_spec = _get_raw_feature_spec(schema)
raw_feature_spec.pop(_LABEL_KEY)
raw_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(
raw_feature_spec, default_batch_size=None)
serving_input_receiver = raw_input_fn()
transformed_features = transform_output.transform_raw_features(
serving_input_receiver.features)
return tf.estimator.export.ServingInputReceiver(
transformed_features, serving_input_receiver.receiver_tensors)
The main difference is that I only expect 1 input: a string of programming languages separated by '|': 'java|python'
.
I then split that string up in my preprocessing function and make it into a multi one hot encoded array of shape 500 (I have exactly 500 options)
It could also be the case that the prediction isn't being correctly transformed by tf transform. (tf transform is part of the tfx pipeline and runs correctly)
request: {"instances": ["javascript|python"]}
response: {"predictions": []}
expected response: {"predictions": [520]}
(its a regression model)