【发布时间】:2019-02-13 22:33:25
【问题描述】:
Tensorflow Serving 在标题中返回错误消息,我不明白为什么。我通过回归 API 调用它,如下面的 sn-p 所示:
using RestSharp;
using Newtonsoft.Json;
var client_myclient = new RestClient("http://192.168.100.1:8501/v1/models/mymodel:regress");
// request preparation
json_prep.examples.Add( blah blah blah);
string json_prep_converted = JsonConvert.SerializeObject(json_prep, Formatting.Indented);
var req_ = new RestRequest(Method.POST);
req_.AddJsonBody(json_prep_converted);
// response
var res_mymodel = client_myclient.Execute(req_candle);
我的错误消息包含以下请求,确认我发送的内容;它只是一个完全如下所示的示例,除了 ... 省略了几个条目:
{
"examples": [
{
"a": [
1.937336,
...
-5.107522
],
"b": [
-0.704486,
...
-6.868737
],
"c": [
2.817943,
...
-4.226915
],
"d": [
-3.346308,
-...
-7.749344
],
"e": [
1.0625,
-0.1875,
...
-0.8125
],
"f": [
0.943968,
-1.17052,
...
0.641898
],
"g": [
0.22639801,
...
0.19194462
],
"h": [
-1.449828,
...
0.34936
],
"i": [
-50.61624,
...
-17.362056
],
"j": [
0.148651,
...
-0.228189
],
"k": [
0.16410813748132047,
...
0.39454449551653981
],
"l": [
0.704047,
...
-1.462873
],
"m": [
4.55,
...
2.54
]
}
]
}
JSON 消息经过双重检查,它不包含我用 ... 替换列表正文的字符串(并且它不能根据定义)
我试图关注official manual on this。
更多细节,原始格式的错误是:
"{ \"error\": \"Expects arg[0] to be float but string is provided\" }"
我该如何解决这个错误?
【问题讨论】:
标签: json tensorflow tensorflow-serving