ucbrise / clipper

A low-latency prediction-serving system
http://clipper.ai
Apache License 2.0
1.4k stars 280 forks source link

what(): Number of model outputs: 1 does not equal the number of inputs: 2 #535

Open aliraza0337 opened 6 years ago

aliraza0337 commented 6 years ago

Can someone give me an example of how an R function with string input and output would look like. I have tried:

pred_fn = function(str) {
    return("value")
}

and then tested like: curl -X POST --header "Content-Type:application/json" -d '{"input": "value"}' 127.0.0.1:1337/app1/predict

It didn't work and I see this error: what(): Number of model outputs: 1 does not equal the number of inputs: 2

But I see both of these are strings of same length.

aliraza0337 commented 6 years ago

Even though I am passing and then returning same variable. I am getting the following error. Number of model outputs: 1 does not equal the number of inputs: 2

my prediction function is as following:

pred_fn = function(str) {
    phenologyForecast(siteName="HarvardForest",URL="http://phenocam.sr.unh.edu/data/archive/harvard/ROI/harvard_DB_0001_1day.csv",forecastLength = 30)
    return(str)
}
simon-mo commented 6 years ago

We use adaptive batching to figure out the optimal batch size for a model. So the input to your function should be a list of str instead of just a single string; it should return a list of string as well.

See https://github.com/ucbrise/clipper/issues/513 for more info.