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

[Serve] Add experimental pipeline docs #20292

Merged
merged 14 commits into from
Nov 17, 2021

Conversation

simon-mo
Copy link
Contributor

@simon-mo simon-mo commented Nov 12, 2021

Why are these changes needed?

This PR adds documentation for the ray.serve.pipeline module.

Related issue number

Closes #19478

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@simon-mo simon-mo changed the title [Serve] Add experimental pipeline docs [Serve] [WIP] Add experimental pipeline docs Nov 12, 2021
@simon-mo simon-mo added the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Nov 12, 2021
@simon-mo simon-mo changed the title [Serve] [WIP] Add experimental pipeline docs [Serve] Add experimental pipeline docs Nov 13, 2021
@simon-mo simon-mo marked this pull request as ready for review November 13, 2021 01:01
@simon-mo simon-mo removed the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Nov 13, 2021
@simon-mo simon-mo requested a review from edoakes November 13, 2021 01:01
@@ -24,7 +24,8 @@ async def call_async(self, input_arg: Tuple[Any]) -> Union[Any, ObjectRef]:
class LocalExecutor(Executor):
"""Executor that runs code in-process."""

def __init__(self, serialized_callable_factory: bytes, config: StepConfig):
def __init__(self, serialized_callable_factory: bytes,
_config: StepConfig):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unused variable, underscore it.

@@ -26,11 +25,8 @@ class Pipeline:
def __init__(self, entry_node: PipelineNode):
self._entry_node = entry_node

def deploy(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

best error is attribute doesn't exist :D.

@simon-mo
Copy link
Contributor Author

@edoakes ready for review

@edoakes
Copy link
Contributor

edoakes commented Nov 13, 2021

@richardliaw help review too please?

@richardliaw
Copy link
Contributor

gave feedback offline.

Copy link
Contributor

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

Awesome start!

@@ -44,6 +44,10 @@ dive.
Model Composition
=================

.. note::
Serve recently added experimental first-class model composition API. Please
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Serve recently added experimental first-class model composition API. Please
Serve recently added an experimental first-class API for model composition (pipelines). Please

please try to be careful about grammar in documentation

@@ -44,6 +44,10 @@ dive.
Model Composition
=================

.. note::
Serve recently added experimental first-class model composition API. Please
take a look at :ref:`Pipeline API <serve-pipeline-api>` and try it out!
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
take a look at :ref:`Pipeline API <serve-pipeline-api>` and try it out!
take a look at the :ref:`Pipeline API <serve-pipeline-api>` and try it out!

Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a call to action for people to file issues or post on forum w/ questions.

Comment on lines 8 to 9
- understand the experimental pipeline API
- build on top of the API to construct your multi-model inference pipelines.
Copy link
Contributor

Choose a reason for hiding this comment

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

inconsistent period usage


.. note::
This API is experimental and the API is subject to change.
We are actively looking for feedback via the Ray Slack or Github issues.
Copy link
Contributor

Choose a reason for hiding this comment

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

add links for these

Suggested change
We are actively looking for feedback via the Ray Slack or Github issues.
We are actively looking for feedback via the Ray Slack or Github issues.

Comment on lines 19 to 20
Serve Pipeline is a standalone package that can be used without Ray Serve.
However, the expected usage is to use it inside your Serve deployment.
Copy link
Contributor

Choose a reason for hiding this comment

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

kind of a weird thing to open with. I'd start with the problem statement: This package is mean to make it seamless to develop and deploy multi-model pipelines. Add a sentence or two about what the advantages are (all in code, good perf)

Comment on lines 49 to 50
For classes, you need to instantiate them with init args first, then pass in their
upstream nodes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
For classes, you need to instantiate them with init args first, then pass in their
upstream nodes.
For classes, you need to instantiate them with init args first, then pass in their
upstream nodes. This allows you to have the same code definition but pass different arguments, like URIs for model weights.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should add an example for that


.. autofunction:: ray.serve.pipeline.step

Here is an example pipeline that uses actors instead of local execution mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

say that local execution mode is useful for testing?

----------------

In this section, we show how to implement a two stage pipeline that's common
for computer vision task. For workload like image classification, the preprocessing
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for computer vision task. For workload like image classification, the preprocessing
for computer vision tasks. For workloads like image classification, the preprocessing

In this section, we show how to implement a two stage pipeline that's common
for computer vision task. For workload like image classification, the preprocessing
steps are CPU bounded and hard to parallelize. The actual inference steps can run
on GPU and batched. They are often split up into separate stages and scaled separately
Copy link
Contributor

Choose a reason for hiding this comment

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

why do I want to batch it?

:end-before: __preprocessing_pipeline_example_end__


Ensemble Example
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a section after this listing more potential use cases?

Also, can we add a simple example of "combining business logic + ML"? This could be just calling out that you can do anything in the "combine output" step

@edoakes
Copy link
Contributor

edoakes commented Nov 14, 2021

@simon-mo can you also add a pointer to this on the index page? Can say something like "Serve is great for model composition -- check out our new pipeline API!"

@simon-mo simon-mo requested a review from edoakes November 16, 2021 20:11
Comment on lines 26 to 27
Ray Serve enables seamless multi-models inference pipeline (also known as model composition). You can
write your inference pipeline all in code and integrate business logic with ML.
Copy link
Contributor

Choose a reason for hiding this comment

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

add link to pipelines here?

@simon-mo simon-mo merged commit 5fccad4 into ray-project:master Nov 17, 2021
@@ -145,5 +148,18 @@ def combiner(greeting1: str, greeting2: str):
assert greeter.call("Teddy") == "Howdy Teddy!|How's it hanging, Teddy?"


def test_cleanup_and_destory(shared_ray_instance):
Copy link
Contributor

Choose a reason for hiding this comment

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

destory --> destroy

jiaodong pushed a commit to jiaodong/ray that referenced this pull request Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Serve] [Pipeline] Prototype Documentation
4 participants