mleap icon indicating copy to clipboard operation
mleap copied to clipboard

API document for mleap-serving 1.13.0

Open Khiem-Tran opened this issue 7 years ago • 10 comments

It seems from release 1.13.0, the mleap-serving API was changed without official document. I found a document here but not success when testing

Here is my steps:

git clone https://github.com/combust/mleap.git
cd mleap && git checkout --detach 6a722e455df7cbcc6da07cf77d6522e38ec1556a
git submodule init
git submodule update
sbt compile
sbt mleap-serving/universal:packageZipTarball
tar -zxvf mleap-serving/target/universal/mleap-serving-0.13.0.tgz 
mkdir /tmp/ml
mv mleap-serving-0.13.0/ /tmp/ml/
/tmp/ml/mleap-serving-0.13.0/bin/mleap-serving

# load model (ok)
curl -X POST \
  http://localhost:8080/models \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: 97c74630-8b22-d9d9-019d-0f9dd13b8d03' \
  -d '{
  "modelName": "airbnb",
  "uri": "<dir>/airbnb.model.lr.zip",
  "config": {
    "memoryTimeout": 1000,
    "diskTimeout": 1000
  },
  "force": false
}'

# find model (not found)
curl -X GET \
  http://localhost:8080/models/airbnb \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: a1ea0066-16a3-4040-cb52-6d138017957b'

# other API like transform or get-meta also don't work

Anything else that I can test?

screen shot 2019-01-08 at 10 40 51 am

Khiem-Tran avatar Jan 08 '19 03:01 Khiem-Tran

@Khiem-Tran I am working on updating the docs here http://mleap-docs.combust.ml/mleap-serving/ but in the meantime, could you please to update the uri on the load model request from /Users/... to file:/Users/.... and see if that solves your issue?

ancasarb avatar Jan 08 '19 16:01 ancasarb

Yes, it works after I added the prefix file: on uri and increase timeout configs from 1000 to 900000 as here. Thank you very much

Btw, there is a small issue that the provided json input does not work with airbnb.model.lr.zip because onehotEncoder not recognise value in some features but working well on random forest model

Khiem-Tran avatar Jan 09 '19 04:01 Khiem-Tran

glad it worked! @Khiem-Tran is it alright to close this issue now?

ancasarb avatar Feb 05 '19 08:02 ancasarb

@ancasarb @Khiem-Tran

i have registered the Model like Below:

body='{"modelName":"airbnb","uri":"file:/models/airbnb.model.lr.zip","config":{"memoryTimeout":900000,"diskTimeout":900000},"force":false}'

curl --header "Content-Type: application/json"
--request POST
--data "$body" http://localhost:8080/models

When i try hit for Transform like Below ways :

body='{"modelName":"airbnb","format":"ml.combust.mleap.json","initTimeout":"35000","tag":0,"frame":"frame.airbnb.json"}'

curl --header "Content-Type: application/json"
--request POST
--data "$body" http://localhost:8080/models/transform

body='/models/frame.airbnb.json'

curl --header "Content-Type: application/json"
--header "timeout: 1000"
--request POST
--data "$body" http://localhost:8080/models/airbnb/transform

i cannot see that data is processing....I Just want to know do we need to give the Filename or json string input ..?

Please Clarify me about this.. Thanks in Advance !! resources:

airbnb.model.lr.zip

and for json encoded mleap : https://s3-us-west-2.amazonaws.com/mleap-demo/frame.airbnb.json

itsmesrds avatar May 09 '19 05:05 itsmesrds

@itsmesrds can you try with the random-forest model from the same tutorial? Last time, I could not use the lr.zip for transforming the json sample. I think the build has some change on features that make the json file is not supported.

Khiem-Tran avatar May 09 '19 06:05 Khiem-Tran

Thank you for the Quick Response... Ok ill try as you suggested ....

@Khiem-Tran please let me know..Do i have to pass the file name or path with file name or file content by converting to json string

i tried with same json ..But still its failing... Thanks

itsmesrds avatar May 09 '19 06:05 itsmesrds

@itsmesrds, I followed this tutorial http://mleap-docs.combust.ml/mleap-serving/#load-model and succeeded to transform the sample json with rf.zip. Maybe you can try -d @/models/frame.airbnb.json

Khiem-Tran avatar May 09 '19 08:05 Khiem-Tran

@itsmesrds you can take a look at this readme file https://github.com/combust/mleap/tree/master/mleap-spring-boot, this is how the transform endpoint works.

endpoint POST /models/{YOUR_MODEL_NAME}/transform: Transform or scoring request, replacing the chosen model name {YOUR_MODEL_NAME}, format {YOUR_FORMAT} and the appropriately encoded leap frame {ENCODED_LEAP_FRAME}

body='{"modelName":"{YOUR_MODEL_NAME}","format":"{YOUR_FORMAT}","initTimeout":"35000","tag":0,"frame":"{ENCODED_LEAP_FRAME}"}'

curl --header "Content-Type: application/json" \
  --request POST \
  --data "$body" http://localhost:8080/models/transform

Format can be either ml.combust.mleap.binary or ml.combust.mleap.json and your leap frame needs to be encoded with that format.

ancasarb avatar May 12 '19 16:05 ancasarb

I'm having the same problems. No matter what I do, I can't get this airbnb example to run properly. It's extremely frustrating. Can you post what a valid value of $body or $ENCODED_LEAP_FRAME looks like ?

@ancasarb

femibyte avatar Oct 16 '19 09:10 femibyte

@femibyte I replied to your question on the other issue raised #578

ancasarb avatar Oct 17 '19 12:10 ancasarb