Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from a custom tornado server to a seldon-core server for serving the model #36

Merged
merged 2 commits into from
Mar 9, 2018
Merged

Move from a custom tornado server to a seldon-core server for serving the model #36

merged 2 commits into from
Mar 9, 2018

Conversation

ankushagarwal
Copy link

@ankushagarwal ankushagarwal commented Mar 9, 2018

  • seldon-core allows wrapping arbitrary models into a REST/GRPC API. We can leverage that feature instead of writing our own boilerplate code for an API server

Related to #11


This change is Reviewable

* Move from a custom tornado server to a seldon-core model

Related to #11
@ankushagarwal
Copy link
Author

/cc @jlewi

@k8s-ci-robot k8s-ci-robot requested a review from jlewi March 9, 2018 00:53
@@ -0,0 +1,11 @@
numpy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you don't mind please use pipenv

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping a seldon-core microservice requires a requirements.txt file: https://github.com/SeldonIO/seldon-core/blob/master/docs/wrappers/python.md#create-a-model-folder

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimexist might want to open an issue in kubeflow/kubeflow or Seldon to follow up with them. @cliveseldon

@ankushagarwal ankushagarwal changed the title Create a end-to-end kubeflow example using seq2seq model (4/n) Move from a custom tornado server to a seldon-core server for serving the model Mar 9, 2018
Copy link
Contributor

@jlewi jlewi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. So glad we were able to get Seldon integrated.

@@ -0,0 +1,11 @@
numpy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jimexist might want to open an issue in kubeflow/kubeflow or Seldon to follow up with them. @cliveseldon


Start the server using `python server.py --port=8888`.
> The model is written in Keras and when exported as a TensorFlow model seems to be incompatible with TensorFlow Serving. So we're using seldon-core to serve this model since seldon-core allows you to serve any arbitrary model. More details [here](https://github.com/kubeflow/examples/issues/11#issuecomment-371005885).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to open up an issue to track models that TFServing doesn't work with so we can loop in various folks e.g. from TFServing team. Its unfortunate that we can't use TFServing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #38


## Sample request
Ensure that you have the following files from the [training](training_the_model.md) step in your `notebooks` directory:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why notebooks directory? What if we trained the model by running a TFJob and the model is stored on GCS/S3?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if they ran the TFJOb on GCS they could just do gsutil to copy from the bucket to their pod.

cd into the notebooks directory and run the following docker command. This will create a build/ directory.

```
cd notebooks/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Seldon's model wrapper support reading the model from GCS/S3?

Could we run the python wrapper as a job on K8s? Could we create a ksonnet template to make it easy to launch such a job.

I don't think we should try to address either of those issues in this PR. But might be good to open up issues to track them.

/cc @cliveseldon @gsunner @ahousley

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does Seldon's model wrapper support reading the model from GCS/S3?

Not that I am aware of. Looking at the instructions, it seems to require all the files in a single folder which contains the code and the model to build the serving image.

Created an issue to track the feature for serving a seldon-core model: kubeflow/kubeflow#405

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is a seldon component in kubeflow. In the next PR, I'll try to deploy this image on k8s using this component

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can specify any persistent volume in definition of the SeldonDeployment in the componentSpec as its a standard Kubernetes PodTemplateSpec. So you can load your parameters from their rather than package them as part of the model image if you wish. The kubeflow-seldon example shows an example using an NFS volume to load the trained model parameters.

./build_image.sh
```

Now you should see an image named `seldonio/issuesummarization:0.1` in your docker images. To test the model, you can run it locally using
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we tag it into a repo like GCR/DockerHub/Quay? We'll need that to deploy the model on K8s.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use a GCR tag.

@k8s-ci-robot
Copy link
Contributor

@jlewi: GitHub didn't allow me to request PR reviews from the following users: ahousley.

Note that only kubeflow members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

Does Seldon's model wrapper support reading the model from GCS/S3?

Could we run the python wrapper as a job on K8s? Could we create a ksonnet template to make it easy to launch such a job.

I don't think we should try to address either of those issues in this PR. But might be good to open up issues to track them.

/cc @cliveseldon @gsunner @ahousley

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jlewi
Copy link
Contributor

jlewi commented Mar 9, 2018

/lgtm
/approval

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jlewi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit d1a2adf into kubeflow:master Mar 9, 2018
@ankushagarwal ankushagarwal deleted the issue_summarization_serving branch March 9, 2018 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants