qiaoguan / deep-ctr-prediction

CTR prediction models based on deep learning(基于深度学习的广告推荐CTR预估模型)
https://github.com/qiaoguan/deep-ctr-prediction
907 stars 276 forks source link

about tf-serving #22

Open ucasiggcas opened 2 years ago

ucasiggcas commented 2 years ago

hi,dear, after Saved the SavedModel according to the official link, I used the tensorflow-model-server reload the SavedModel, but when I use requests to query, I got the bug bellow,

>>> headers
{'content-type': 'application/json'}
>>> data
'{"signature_name": "serving_default", "instances": [{"age": [46.0], "education_num": [10.0], "capital_gain": [7688.0], "capital_loss": [0.0], "hours_per_week": [38.0]}, {"age": [24.0], "education_num": [13.0], "capital_gain": [0.0], "capital_loss": [0.0], "hours_per_week": [50.0]}]}'
>>> jp=requests.post(url2,data=data,headers=headers)
>>> jp.text
'{\n    "error": "Failed to process element: 0 key: age of \'instances\' list. Error: INVALID_ARGUMENT: JSON object: does not have named input: age"\n}'
ucasiggcas commented 2 years ago

and the results from saved_model_cli is Okay

saved_model_cli run --dir models/wdSavedModel/1647337804/ --tag_set serve --signature_def="predict" --input_examples='examples=[{"age":[46.], "education_num":[10.], "capital_gain":[7688.], "capital_loss":[0.], "hours_per_week":[38.]}, {"age":[24.], "education_num":[13.], "capital_gain":[0.], "capital_loss":[0.], "hours_per_week":[50.]}]'
Result for output key all_class_ids:
[[0 1]
 [0 1]]
Result for output key all_classes:
[[b'0' b'1']
 [b'0' b'1']]
Result for output key class_ids:
[[1]
 [0]]
Result for output key classes:
[[b'1']
 [b'0']]
Result for output key logistic:
[[0.9291346 ]
 [0.17225692]]
Result for output key logits:
[[ 2.5734713]
 [-1.5697157]]
Result for output key probabilities:
[[0.0708654  0.9291346 ]
 [0.82774305 0.17225692]]

so what's the matter ?