-
Notifications
You must be signed in to change notification settings - Fork 823
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
179 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,25 @@ | ||
# Workflow examples | ||
|
||
The following links provide examples on how to implement workflows with different models. The workflow feature can be used for serving an ensemble of models and python functions through workflow APIs. A workflow is executed as a DAG where the nodes can be either models (MAR files) or functions specified in the workflow handler file. The DAG need not contain additional functions if not required. Typically, the function nodes are used for processing or augmenting intermediate data or aggregating data from multiple nodes. Preprocessing nodes are used when we want to apply some common transformation to an input payload which is going to be passed to multiple model nodes. An example use case for this would be a preprocessing node passing transformed data to two branches with model nodes (refer dog/breed classification example below). In other cases, having a preprocessing step in the model handler itself might suffice. | ||
Workflows can be used to compose an ensemble of Pytorch models and Python functions and package them in a `war` file. A workflow is executed as a DAG where the nodes can be either Pytorch models packaged as `mar` files or function nodes specified in the workflow handler file. The DAG can be used to define both sequential or parallel pipelines. | ||
|
||
It is also possible to use the same mar file in multiple workflows and register them at the same time. The model server will create separate instances of this model for the different workflows. This is demonstrated in the NMT Transformers example where the English-to-German model is used in both back translation and dual translation workflows. | ||
As an example a sequential pipeline may look something like | ||
|
||
The following examples show the current workflows supported in this release. This include sequential pipeline and parallel models where you can aggregate the results. This can be used for ensemble models that votes on a task and results are aggregated in the post-processing function in the handler. Further examples will be added soon. | ||
``` | ||
input -> function1 -> model1 -> model2 -> function2 -> output | ||
``` | ||
|
||
For a more detailed explanation of Workflows and what is currently supported please refer to the main [documentation](../../docs/workflows.md) | ||
And a parallel pipeline may look something like | ||
|
||
``` | ||
model1 | ||
/ \ | ||
input -> preprocessing -> -> aggregate_func | ||
\ / | ||
model2 | ||
``` | ||
|
||
* [Pipeline/Sequential workflow using nmt tranformers example](nmt_tranformers_pipeline/) | ||
* [Pipeline/Sequential workflow using resnet for dog breed classification](dog_breed_classification/) | ||
You can experiment with much more complicated workflows by configuring a `YAML` file. We've included 2 reference examples including a sequential pipeline and parallel pipeline. | ||
* [Parallel workflow using nmt transformers example](nmt_transformers_pipeline/) | ||
* [Sequential workflow using resnet for dog breed classification](dog_breed_classification/) | ||
|
||
For a more detailed explanation of Workflows and what is currently supported please refer to the main [documentation](../../docs/workflows.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# syntax = docker/dockerfile:experimental | ||
# | ||
# Following comments have been shamelessly copied from https://github.com/pytorch/pytorch/blob/master/Dockerfile | ||
# | ||
# NOTE: To build this you will need a docker version > 18.06 with | ||
# experimental enabled and DOCKER_BUILDKIT=1 | ||
# | ||
# If you do not use buildkit you are not going to have a good time | ||
# | ||
# For reference: | ||
# https://docs.docker.com/develop/develop-images/build_enhancements | ||
|
||
ARG BASE_IMAGE=pytorch/torchserve:latest | ||
FROM ${BASE_IMAGE} | ||
|
||
USER root | ||
|
||
RUN pip install --upgrade pip | ||
|
||
COPY requirements.txt requirements.txt | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
COPY dockerd-entrypoint.sh /usr/local/bin/dockerd-entrypoint.sh | ||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.sh | ||
COPY kfserving_wrapper kfserving_wrapper | ||
COPY config.properties config.properties | ||
|
||
USER model-server | ||
|
||
ENTRYPOINT ["/usr/local/bin/dockerd-entrypoint.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.