clipper icon indicating copy to clipboard operation
clipper copied to clipboard

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

Open aliraza0337 opened this issue 6 years ago • 2 comments

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 avatar Jul 11 '18 00:07 aliraza0337

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)
}

aliraza0337 avatar Jul 11 '18 03:07 aliraza0337

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.

simon-mo avatar Jul 11 '18 21:07 simon-mo