Is there some demo about Uses Predict API that with multi params? what if tool occur error When I use in my model

55 views
Skip to first unread message

guirong guo

unread,
Jan 20, 2022, 8:00:12 AM1/20/22
to What-If Tool
as you Know I have test my TfRecord in local success, but use in what if too occur error as blow: 

Model inference failed: <_InactiveRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "input size does not match signature: 1!=4 len({input}) != len({dense_input,seq_input,sparse_ids_input,sparse_wgt_input}). 


jwe...@google.com

unread,
Jan 20, 2022, 8:06:30 AM1/20/22
to What-If Tool
Unfortunately, none of the demos show use of the Predict API. The code for using this API only supports models where it expects its input as a serialized TF.Example proto which it deserializes and then parses features from (this is how the Predict API functioned originally, I believe now it allows multi-param passing).

To use WIT with a model like that, I suggest you write a custom prediction function in python that takes your examples from your TFRecord format and makes the correct API call to the model and returns the results, instead of having WIT try to use the Predict API. See instructions at https://pair-code.github.io/what-if-tool/learn/tutorials/custom-prediction/

Sorry for the inconvenience, I hope this helps.

Joel Quesada Vallejo

unread,
Nov 22, 2022, 12:01:07 PM11/22/22
to What-If Tool
Hello! Do you plan to support this in the future? 

jwe...@google.com

unread,
Nov 22, 2022, 12:02:10 PM11/22/22
to What-If Tool
We have no plans to add new features such as this. But you should be able to write a custom prediction function to make use of the Predict API as described previously in the thread.
Reply all
Reply to author
Forward
0 new messages