【问题标题】:TensorFlow Serving crossed columns strange errorTensorFlow Serving 交叉列奇怪的错误
【发布时间】:2020-01-05 14:23:31
【问题描述】:

我在尝试向我保存的模型发送预测请求时收到以下错误,该模型使用 TensorFlow Serving 运行:

{
    "error": "Expected D2 of index to be 2 got 3 at position 0\n\t [[{{node linear/linear_model/linear_model/linear_model/int2Id_X_stringId/SparseCross}}]]"
}

问题似乎来自尝试在线性模型中使用交叉列...?

我的服务模型是 tf.estimator.LinearClassifier 。我的 REST API 请求是对“model_directory/model:predict”的 POST,输入如下:

{ "signature_name": "predict",
    "instances": [{
         "intId" : [2],
        "int2Id": [847],
        "int3Id": [0],
        "int4Id":[3],
        "stringId" : ["STRING"]}]
}

奇怪的是,在本地使用 saved_model_cli 和以下命令来获得预测工作得很好:

saved_model_cli run --dir Workspace/saves/1567433674 --tag_set serve --signature_def predict --input_exprs int4Id=[3];int1Id=[2];stringId=['STRING'];int3Id=[0];int2Id=[847]

目标是从我的服务模型中获得预测输出,该输出类似于我使用 saved_model_cli 时的输出。像这样的:

Result for output key all_class_ids:
[[0 1 2 3 4 5]]
Result for output key all_classes:
[[b'0' b'1' b'2' b'3' b'4' b'5']]
Result for output key class_ids:
[[2]]
Result for output key classes:
[[b'2']]
Result for output key logits:
[[ 0.11128154 -0.44881764  0.31520572 -0.08318427 -0.3479367  -0.08883157]]
Result for output key probabilities:
[[0.19719791 0.11263006 0.2418051  0.16234797 0.12458517 0.16143374]]

【问题讨论】:

    标签: tensorflow tensorflow-datasets tensorflow-serving tensorflow-estimator


    【解决方案1】:

    将“实例”更改为“输入”,然后再试一次。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-21
      • 2020-07-31
      • 2014-07-11
      • 1970-01-01
      • 1970-01-01
      • 2020-04-21
      • 2018-05-16
      • 1970-01-01
      相关资源
      最近更新 更多