Giter Site home page Giter Site logo

JSON response from prediction about clipper HOT 21 CLOSED

ucbrise avatar ucbrise commented on August 27, 2024
JSON response from prediction

from clipper.

Comments (21)

dcrankshaw avatar dcrankshaw commented on August 27, 2024 2

Ahh I closed the issue too early. We ended up splitting some of the work to address this into CLIPPER-143 which hasn't been completed yet.

from clipper.

dcrankshaw avatar dcrankshaw commented on August 27, 2024 1

You are correct. This is currently the case. We have an open JIRA issue CLIPPER-107 to address this.

It's a fairly high priority for us. I expect we will get to it sometime this week.

from clipper.

rmdort avatar rmdort commented on August 27, 2024 1

Cool. Do you have an ETA for this feature? We are eager to use clipper in our product :)

from clipper.

dcrankshaw avatar dcrankshaw commented on August 27, 2024 1

JSON requests are currently supported. You can specify containers that expect strings as input, which can of course be JSON strings. And yes ultimately all inputs come to Clipper as JSON through the REST interface.

The issue under discussion was being able to return arbitrary JSON from containers, which is not currently supported but will be shortly.

from clipper.

Corey-Zumar avatar Corey-Zumar commented on August 27, 2024 1

This is now under review: #134

from clipper.

Corey-Zumar avatar Corey-Zumar commented on August 27, 2024 1

@frank2wang87 That's presently the case. y_hat_ will be a string (json-formatted or otherwise) after #134 is merged.

from clipper.

dcrankshaw avatar dcrankshaw commented on August 27, 2024

Fixed by #116

from clipper.

rmdort avatar rmdort commented on August 27, 2024

How does this work? I still cant return a string from my container

def predict_strings(self, inputs):
       	print ('received input', inputs)
       	return 'Hello'

It seems like the output from query_frontend.hpp is casted as float

Line 289

clipper::json::add_double(json_response, PREDICTION_RESPONSE_KEY_OUTPUT,
                              query_response.output_.y_hat_);

Am i doing something wrong? I created an app which accepts strings and i want to output a custom json.

from clipper.

AirAI avatar AirAI commented on August 27, 2024

It seems that the image should be translated to a list to generate a json request.(Line 123 in cifar_utils.py)

req_json = json.dumps({'uid': uid, 'input': list(x)})

The list is then translated to original image if the model container receive the true image as input. It is low efficiency when disposing large image or video. Correct me if I am wrong.

Does the clipper support REST input? i.e, does clipper receive original image(or video, or texture) as input and transfer it to the docker container?

from clipper.

frank2wang87 avatar frank2wang87 commented on August 27, 2024

When will this feature be published? We are eager to use it :)

from clipper.

dcrankshaw avatar dcrankshaw commented on August 27, 2024

@Corey-Zumar what's the status of this?

from clipper.

Corey-Zumar avatar Corey-Zumar commented on August 27, 2024

@dcrankshaw In progress - continuing to work on it tonight and tomorrow

from clipper.

frank2wang87 avatar frank2wang87 commented on August 27, 2024

L389 in query_frontend.hpp
clipper::json::add_double(json_response, PREDICTION_RESPONSE_KEY_OUTPUT, query_response.output_.y_hat_);

Now it still returns a double output(double y_hat_). Am I right ?

from clipper.

frank2wang87 avatar frank2wang87 commented on August 27, 2024

Cool.

from clipper.

AirAI avatar AirAI commented on August 27, 2024

Has this issue been solved yet? When will the 0.1 alpha be released? We are looking forward to it.

from clipper.

Corey-Zumar avatar Corey-Zumar commented on August 27, 2024

Waiting on #134 to be merged. IMO, the change is stable. You can merge the branch associated with #134 into your copy of the repo and start experimenting with the functionality.

from clipper.

rmdort avatar rmdort commented on August 27, 2024

Any ETA on when this is going to be merged?

from clipper.

dcrankshaw avatar dcrankshaw commented on August 27, 2024

Just merged. I was out of town traveling for a few days which caused a delay.

from clipper.

rmdort avatar rmdort commented on August 27, 2024

I am still not able to send a simple JSON using predict_strings.

The following code

def predict_strings(self, inputs):
    return json.dumps(['foo', {'bar': ('baz')}])

gives the output

{"query_id":13,"output":"\u0001","default":false}

Am i doing anything wrong here?

from clipper.

dcrankshaw avatar dcrankshaw commented on August 27, 2024

Hmm let me dig into this. I'll report back soon.

from clipper.

dcrankshaw avatar dcrankshaw commented on August 27, 2024

Ahh the problem is how you are formulating the JSON response. The input to the predict function is a list of strings and Clipper expects you to return a list of JSON responses, one for each input. Try this:

def predict_strings(self, inputs):
    outputs = []
    for i in inputs:
        outputs.append(json.dumps(['foo', {'bar': ('baz')}]))
    return outputs

I just added some more explicit type checking in #151 to make this easier to catch.

from clipper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.