This workshop is available from the Wallaroo Workshop GitHub Repository.
The Hugging Face LLM Summarization model is a pre-trained model that condenses text into a shorter format. This tutorial demonstrates how to:
Wallaroo Ops Center provides the ability to publish Wallaroo pipelines to an Open Continer Initative (OCI) compliant registry, then deploy those pipelines on edge devices as Docker container or Kubernetes pods. See Wallaroo SDK Essentials Guide: Pipeline Edge Publication for full details.
This demonstration will focus on deployment to the edge. The sample model is available at the following URL. This model should be downloaded and placed into the ./models/llm-summarization
folder before beginning this demonstration.
model-auto-conversion_hugging-face_complex-pipelines_hf-summarisation-bart-large-samsun.zip (1.4 GB)
The following details the steps a Data Scientist performs in uploading and verifying the model in a Wallaroo Ops server.
The first step is loading the required libraries including the Wallaroo Python module.
# Import Wallaroo Python SDK
import wallaroo
from wallaroo.object import EntityNotFoundError
from wallaroo.framework import Framework
# used to display DataFrame information without truncating
from IPython.display import display
import pandas as pd
pd.set_option('display.max_colwidth', None)
import pyarrow as pa
The next step is to connect to Wallaroo through the Wallaroo client. The Python library is included in the Wallaroo install and available through the Jupyter Hub interface provided with your Wallaroo environment.
This is accomplished using the wallaroo.Client()
command, which provides a URL to grant the SDK permission to your specific Wallaroo environment. When displayed, enter the URL into a browser and confirm permissions. Store the connection into a variable that can be referenced later.
If logging into the Wallaroo instance through the internal JupyterHub service, use wl = wallaroo.Client()
. For more information on Wallaroo Client settings, see the Client Connection guide.
wl = wallaroo.Client()
We’ll use the SDK below to create our workspace , assign as our current workspace, then display all of the workspaces we have at the moment. We’ll also set up variables for our models and pipelines down the road, so we have one spot to change names to whatever fits your organization’s standards best.
To allow this tutorial to be run by multiple users in the same Wallaroo instance, update suffix with your first and last name. For example:
suffix = 'lazel-geth'
Set the model name, file name, pipeline name, and workspace name.
Sample code:
suffix = ''
model_name = 'llm-summarization'
model_filename = './models/llm-summarization/model-auto-conversion_hugging-face_complex-pipelines_hf-summarisation-bart-large-samsun.zip'
pipeline_name = 'llm-edge-summarization'
workspace_name = f'llm-edge-summarization{suffix}'
suffix = ''
model_name = 'llm-summarization'
model_filename = './models/llm-summarization/model-auto-conversion_hugging-face_complex-pipelines_hf-summarisation-bart-large-samsun.zip'
pipeline_name = 'llm-edge-summarization'
workspace_name = f'llm-edge-summarization{suffix}'
Set the current workspace where the models are uploaded to and pipelines created.
Setting the workspace is performed with the wallaroo.client.set_current_workspace(workspace)
method.
Sample code:
workspace = get_workspace(workspace_name, client)
wl.set_current_workspace(workspace)
def get_workspace(name):
workspace = None
for ws in wl.list_workspaces():
if ws.name() == name:
workspace= ws
if(workspace == None):
workspace = wl.create_workspace(name)
return workspace
workspace = get_workspace(workspace_name)
wl.set_current_workspace(workspace)
{'name': 'llm-edge-summarization', 'id': 8, 'archived': False, 'created_by': 'a6e82da8-817d-4cca-bb62-5dbacd38ca22', 'created_at': '2023-12-05T20:43:07.604805+00:00', 'models': [{'name': 'llm-summarization', 'versions': 1, 'owner_id': '""', 'last_update_time': datetime.datetime(2023, 12, 5, 20, 44, 13, 14974, tzinfo=tzutc()), 'created_at': datetime.datetime(2023, 12, 5, 20, 44, 13, 14974, tzinfo=tzutc())}], 'pipelines': [{'name': 'llm-edge-summarization', 'create_time': datetime.datetime(2023, 12, 5, 20, 48, 36, 535526, tzinfo=tzutc()), 'definition': '[]'}]}
When a model is uploaded to a Wallaroo cluster, it is optimized and packaged to make it ready to run as part of a pipeline. In many times, the Wallaroo Server can natively run a model without any Python overhead. In other cases, such as a Python script, a custom Python environment will be automatically generated. This is comparable to the process of “containerizing” a model by adding a small HTTP server and other wrapping around it.
Our pretrained model is in the Hugging Face framework, which is specified in the framework
parameter. Hugging Face is a non-native runtime, which requires that the input and output schemas as specified during the model upload process.
The model name and file name were set in the variables above. Use them to upload the model.
Sample code:
input_schema = pa.schema([
pa.field('inputs', pa.string()),
pa.field('return_text', pa.bool_()),
pa.field('return_tensors', pa.bool_()),
pa.field('clean_up_tokenization_spaces', pa.bool_()),
# pa.field('generate_kwargs', pa.map_(pa.string(), pa.null())), # dictionaries are not currently supported by the engine
])
output_schema = pa.schema([
pa.field('summary_text', pa.string()),
])
model = wl.upload_model(model_name,
model_filename,
framework=wallaroo.framework.Framework.HUGGING_FACE_SUMMARIZATION,
input_schema=input_schema,
output_schema=output_schema
)
# Upload Retrained LLM Summarization Model
input_schema = pa.schema([
pa.field('inputs', pa.string()),
pa.field('return_text', pa.bool_()),
pa.field('return_tensors', pa.bool_()),
pa.field('clean_up_tokenization_spaces', pa.bool_()),
# pa.field('generate_kwargs', pa.map_(pa.string(), pa.null())), # dictionaries are not currently supported by the engine
])
output_schema = pa.schema([
pa.field('summary_text', pa.string()),
])
model = wl.upload_model(model_name,
model_filename,
framework=wallaroo.framework.Framework.HUGGING_FACE_SUMMARIZATION,
input_schema=input_schema,
output_schema=output_schema
)
Waiting for model loading - this will take up to 10.0min.
Model is pending loading to a container runtime..
Model is attempting loading to a container runtime.............................................successful
Ready
For our pipeline we set the deployment configuration to set the resources the pipeline will be allocated from the Kubernetes cluster hosting the Wallaroo Ops instance. The Hugging Face model is deployed as a Containerized Runtime in Wallaroo, so the configuration specified the sidekick
cpu and memory options.
Use the deployment configuration below.
deployment_config = wallaroo.DeploymentConfigBuilder() \
.cpus(0.25).memory('1Gi') \
.sidekick_cpus(model, 4) \
.sidekick_memory(model, "8Gi") \
.build()
Now we build our pipeline and set our Yolo8 model as a pipeline step, then deploy the pipeline using the deployment configuration above.
We’ll do both commands in one step:
wallaroo.client.build_pipeline
.wallaroo.pipeline.add_model_step(model)
method.Sample code:
pipeline = wl.build_pipeline(pipeline_name) \
.add_model_step(model)
pipeline = wl.build_pipeline(pipeline_name) \
.add_model_step(model)
We deploy the pipeline with the wallaroo.pipeline.deploy(deployment_config)
command, using the deployment configuration set up in previous steps.
Deploy the pipeline.
Sample code:
pipeline.deploy(deployment_config=deployment_config)
pipeline.deploy(deployment_config=deployment_config)
name | llm-edge-summarization |
---|---|
created | 2023-12-05 20:48:36.535526+00:00 |
last_updated | 2023-12-05 20:48:37.172602+00:00 |
deployed | True |
arch | None |
tags | |
versions | 040afe0c-9a17-4f0b-8cb2-68e8dc85d9a4, 6f1db20f-e1b5-47a5-a6b4-c6a31f9c1023 |
steps | llm-summarization |
published | False |
We submit the DataFrame to the pipeline using wallaroo.pipeline.infer
and display the results. We’ll use both the Wallaroo SDK and the MLOps API.
Perform an inference request. We’ll generate our sample dataframe, then use it for the inference.
Sample Code:
# sample dataframe input
input_data = {
"inputs": ["LinkedIn (/lɪŋktˈɪn/) is a business and employment-focused social media platform that works through websites and mobile apps. It launched on May 5, 2003. It is now owned by Microsoft. The platform is primarily used for professional networking and career development, and allows jobseekers to post their CVs and employers to post jobs. From 2015 most of the company's revenue came from selling access to information about its members to recruiters and sales professionals. Since December 2016, it has been a wholly owned subsidiary of Microsoft. As of March 2023, LinkedIn has more than 900 million registered members from over 200 countries and territories. LinkedIn allows members (both workers and employers) to create profiles and connect with each other in an online social network which may represent real-world professional relationships. Members can invite anyone (whether an existing member or not) to become a connection. LinkedIn can also be used to organize offline events, join groups, write articles, publish job postings, post photos and videos, and more"], # required
"return_text": [True], # optional: using the defaults, similar to not passing this parameter
"return_tensors": [False], # optional: using the defaults, similar to not passing this parameter
"clean_up_tokenization_spaces": [False], # optional: using the defaults, similar to not passing this parameter
}
dataframe = pd.DataFrame(input_data)
dataframe
# sample dataframe input
input_data = {
"inputs": ["LinkedIn (/lɪŋktˈɪn/) is a business and employment-focused social media platform that works through websites and mobile apps. It launched on May 5, 2003. It is now owned by Microsoft. The platform is primarily used for professional networking and career development, and allows jobseekers to post their CVs and employers to post jobs. From 2015 most of the company's revenue came from selling access to information about its members to recruiters and sales professionals. Since December 2016, it has been a wholly owned subsidiary of Microsoft. As of March 2023, LinkedIn has more than 900 million registered members from over 200 countries and territories. LinkedIn allows members (both workers and employers) to create profiles and connect with each other in an online social network which may represent real-world professional relationships. Members can invite anyone (whether an existing member or not) to become a connection. LinkedIn can also be used to organize offline events, join groups, write articles, publish job postings, post photos and videos, and more"], # required
"return_text": [True], # optional: using the defaults, similar to not passing this parameter
"return_tensors": [False], # optional: using the defaults, similar to not passing this parameter
"clean_up_tokenization_spaces": [False], # optional: using the defaults, similar to not passing this parameter
}
dataframe = pd.DataFrame(input_data)
dataframe
inputs | return_text | return_tensors | clean_up_tokenization_spaces | |
---|---|---|---|---|
0 | LinkedIn (/lɪŋktˈɪn/) is a business and employment-focused social media platform that works through websites and mobile apps. It launched on May 5, 2003. It is now owned by Microsoft. The platform is primarily used for professional networking and career development, and allows jobseekers to post their CVs and employers to post jobs. From 2015 most of the company's revenue came from selling access to information about its members to recruiters and sales professionals. Since December 2016, it has been a wholly owned subsidiary of Microsoft. As of March 2023, LinkedIn has more than 900 million registered members from over 200 countries and territories. LinkedIn allows members (both workers and employers) to create profiles and connect with each other in an online social network which may represent real-world professional relationships. Members can invite anyone (whether an existing member or not) to become a connection. LinkedIn can also be used to organize offline events, join groups, write articles, publish job postings, post photos and videos, and more | True | False | False |
Use the Pipeline Deployment URL for the inference request, and submit the sample DataFrame as our input.
Sample code:
!curl {pipeline._deployment._url()} \
-H "Content-Type: application/json; format=pandas-records" \
-H "Authorization: {wl.auth.auth_header()['Authorization']}" \
-H "Accept:{headers['Accept']}" \
--data @./data/llm-summarization/test_summarization.df.json
# inference request here
!curl {pipeline._deployment._url()} \
-H "Content-Type: application/json; format=pandas-records" \
-H "Authorization: {wl.auth.auth_header()['Authorization']}" \
-H "Accept:{headers['Accept']}" \
--data @./data/llm-summarization/test_summarization.df.json
With the testing complete, we undeploy the pipeline and return the resources back to the cluster.
Sample code:
pipeline.undeploy()
# undeploy the pipeline
pipeline.undeploy()
name | llm-edge-summarization |
---|---|
created | 2023-12-05 20:48:36.535526+00:00 |
last_updated | 2023-12-05 20:48:37.172602+00:00 |
deployed | False |
arch | None |
tags | |
versions | 040afe0c-9a17-4f0b-8cb2-68e8dc85d9a4, 6f1db20f-e1b5-47a5-a6b4-c6a31f9c1023 |
steps | llm-summarization |
published | False |
It worked! For a demo, we’ll take working once as “tested”. So now that we’ve tested our pipeline, we are ready to publish it for edge deployment.
Publishing it means assembling all of the configuration files and model assets and pushing them to an Open Container Initiative (OCI) repository set in the Wallaroo instance as the Edge Registry service. DevOps engineers then retrieve that image and deploy it through Docker, Kubernetes, or similar deployments.
See Edge Deployment Registry Guide for details on adding an OCI Registry Service to Wallaroo as the Edge Deployment Registry.
This is done through the SDK command wallaroo.pipeline.publish(deployment_config)
which has the following parameters and returns.
The publish
method takes the following parameters. The containerized pipeline will be pushed to the Edge registry service with the model, pipeline configurations, and other artifacts needed to deploy the pipeline.
Parameter | Type | Description |
---|---|---|
deployment_config | wallaroo.deployment_config.DeploymentConfig (Optional) | Sets the pipeline deployment configuration. For example: For more information on pipeline deployment configuration, see the Wallaroo SDK Essentials Guide: Pipeline Deployment Configuration. |
Field | Type | Description |
---|---|---|
id | integer | Numerical Wallaroo id of the published pipeline. |
pipeline version id | integer | Numerical Wallaroo id of the pipeline version published. |
status | String | The status of the pipeline publication. Values include:
|
Engine URL | String | The URL of the published pipeline engine in the edge registry. |
Pipeline URL | String | The URL of the published pipeline in the edge registry. |
Helm Chart URL | String | The URL of the helm chart for the published pipeline in the edge registry. |
Helm Chart Reference | String | The help chart reference. |
Helm Chart Version | String | The version of the Helm Chart of the published pipeline. This is also used as the Docker tag. |
Engine Config | wallaroo.deployment_config.DeploymentConfig | The pipeline configuration included with the published pipeline. |
Created At | DateTime | When the published pipeline was created. |
Updated At | DateTime | When the published pipeline was updated. |
We will now publish the pipeline to our Edge Deployment Registry with the pipeline.publish(deployment_config)
command. deployment_config
is an optional field that specifies the pipeline deployment. This can be overridden by the DevOps engineer during deployment.
Save the publish to a variable for later use.
Sample code:
pub = pipeline.publish(deployment_config)
pub
pub = pipeline.publish(deployment_config)
pub
Waiting for pipeline publish... It may take up to 600 sec.
Pipeline is Publishing................Published.
ID | 1 |
Pipeline Version | 1c8d0586-f3ff-453c-82a9-14602830f97f |
Status | Published |
Engine URL | ghcr.io/wallaroolabs/doc-samples/engines/proxy/wallaroo/ghcr.io/wallaroolabs/standalone-mini:v2023.4.0-4103 |
Pipeline URL | ghcr.io/wallaroolabs/doc-samples/pipelines/llm-edge-summarization:1c8d0586-f3ff-453c-82a9-14602830f97f |
Helm Chart URL | oci://ghcr.io/wallaroolabs/doc-samples/charts/llm-edge-summarization |
Helm Chart Reference | ghcr.io/wallaroolabs/doc-samples/charts@sha256:0a0c5b2df650b33fe4457a6eb7b2701caea19d0c81f97c0fe6345b088baaac41 |
Helm Chart Version | 0.0.1-1c8d0586-f3ff-453c-82a9-14602830f97f |
Engine Config | {'engine': {'resources': {'limits': {'cpu': 1.0, 'memory': '512Mi'}, 'requests': {'cpu': 1.0, 'memory': '512Mi'}}}, 'engineAux': {'images': {}}, 'enginelb': {'resources': {'limits': {'cpu': 1.0, 'memory': '512Mi'}, 'requests': {'cpu': 1.0, 'memory': '512Mi'}}}} |
User Images | [] |
Created By | john.hummel@wallaroo.ai |
Created At | 2023-12-05 20:50:16.153199+00:00 |
Updated At | 2023-12-05 20:50:16.153199+00:00 |
Docker Run Variables | {} |
The method wallaroo.client.list_pipelines()
shows a list of all pipelines in the Wallaroo instance, and includes the published
field that indicates whether the pipeline was published to the registry (True
), or has not yet been published (False
).
List the pipelines and verify which ones are published or not.
Sample code:
wl.list_pipelines()
wl.list_pipelines()
name | created | last_updated | deployed | arch | tags | versions | steps | published |
---|---|---|---|---|---|---|---|---|
llm-edge-summarization | 2023-05-Dec 20:48:36 | 2023-05-Dec 20:50:14 | False | None | 1c8d0586-f3ff-453c-82a9-14602830f97f, 040afe0c-9a17-4f0b-8cb2-68e8dc85d9a4, 6f1db20f-e1b5-47a5-a6b4-c6a31f9c1023 | llm-summarization | True |
All publishes created from a pipeline are displayed with the wallaroo.pipeline.publishes
method. The pipeline_version_id
is used to know what version of the pipeline was used in that specific publish. This allows for pipelines to be updated over time, and newer versions to be sent and tracked to the Edge Deployment Registry service.
N/A
A List of the following fields:
Field | Type | Description |
---|---|---|
id | integer | Numerical Wallaroo id of the published pipeline. |
pipeline_version_id | integer | Numerical Wallaroo id of the pipeline version published. |
engine_url | String | The URL of the published pipeline engine in the edge registry. |
pipeline_url | String | The URL of the published pipeline in the edge registry. |
created_by | String | The email address of the user that published the pipeline. |
Created At | DateTime | When the published pipeline was created. |
Updated At | DateTime | When the published pipeline was updated. |
List the publishes from a pipeline.
Sample code:
pipeline.publishes()
pipeline.publishes()
id | pipeline_version_name | engine_url | pipeline_url | created_by | created_at | updated_at |
---|---|---|---|---|---|---|
1 | 1c8d0586-f3ff-453c-82a9-14602830f97f | ghcr.io/wallaroolabs/doc-samples/engines/proxy/wallaroo/ghcr.io/wallaroolabs/standalone-mini:v2023.4.0-4103 | ghcr.io/wallaroolabs/doc-samples/pipelines/llm-edge-summarization:1c8d0586-f3ff-453c-82a9-14602830f97f | john.hummel@wallaroo.ai | 2023-05-Dec 20:50:16 | 2023-05-Dec 20:50:16 |
With the pipeline publish created, we can add an Edge Location. This allows the edge deployment to upload its inference results back to the Wallaroo Ops location, which are then added to the pipeline the publish originated from. These are added to the pipeline logs partition
metadata.
First we’ll retrieve the pipeline logs for our current pipeline, and show the current pipeline logs metadata.
For the edge name, set it to firstname-lastname-edge-yolo
.
Display the log information with the metadata.partition
, then add the edge location to the publish. Note that edge names must be unique, so add your first and last name to the list.
Sample code:
logs = pipeline.logs(dataset=['time', 'out.output0', 'metadata'])
display(logs.loc[:, ['time', 'metadata.partition']])
first_last_name = '-Gale-Karlach'
edge_name = f'hf-summarizer-edge-demo{first_last_name}'
edge_publish = pub.add_edge(edge_name)
display(edge_publish)
logs = pipeline.logs(dataset=['time', 'out.summary_text', 'metadata'])
display(logs.loc[:, ['time', 'out.summary_text', 'metadata.partition']])
time | out.summary_text | metadata.partition | |
---|---|---|---|
0 | 2023-12-05 20:49:24.105 | LinkedIn is a business and employment-focused social media platform that works through websites and mobile apps. It launched on May 5, 2003. LinkedIn allows members (both workers and employers) to create profiles and connect with each other in an online social network which may represent real-world professional relationships. | engine-66f69d685-4d4s2 |
edge_name = 'edge-summarization-demo-arm'
edge_publish = pub.add_edge(edge_name)
display(edge_publish)
ID | 1 |
Pipeline Version | 1c8d0586-f3ff-453c-82a9-14602830f97f |
Status | Published |
Engine URL | ghcr.io/wallaroolabs/doc-samples/engines/proxy/wallaroo/ghcr.io/wallaroolabs/standalone-mini:v2023.4.0-4103 |
Pipeline URL | ghcr.io/wallaroolabs/doc-samples/pipelines/llm-edge-summarization:1c8d0586-f3ff-453c-82a9-14602830f97f |
Helm Chart URL | oci://ghcr.io/wallaroolabs/doc-samples/charts/llm-edge-summarization |
Helm Chart Reference | ghcr.io/wallaroolabs/doc-samples/charts@sha256:0a0c5b2df650b33fe4457a6eb7b2701caea19d0c81f97c0fe6345b088baaac41 |
Helm Chart Version | 0.0.1-1c8d0586-f3ff-453c-82a9-14602830f97f |
Engine Config | {'engine': {'resources': {'limits': {'cpu': 1.0, 'memory': '512Mi'}, 'requests': {'cpu': 1.0, 'memory': '512Mi'}}}, 'engineAux': {'images': {}}, 'enginelb': {'resources': {'limits': {'cpu': 1.0, 'memory': '512Mi'}, 'requests': {'cpu': 1.0, 'memory': '512Mi'}}}} |
User Images | [] |
Created By | john.hummel@wallaroo.ai |
Created At | 2023-12-05 20:50:16.153199+00:00 |
Updated At | 2023-12-05 20:50:16.153199+00:00 |
Docker Run Variables | {'EDGE_BUNDLE': 'abcde'} |
Once a pipeline is deployed to the Edge Registry service, it can be deployed in environments such as Docker, Kubernetes, or similar container running services by a DevOps engineer.
First, the DevOps engineer must authenticate to the same OCI Registry service used for the Wallaroo Edge Deployment registry.
For more details, check with the documentation on your artifact service. The following are provided for the three major cloud services:
For the deployment, the engine URL is specified with the following environmental variables:
DEBUG
(true|false): Whether to include debug output.OCI_REGISTRY
: The URL of the registry service.CONFIG_CPUS
: The number of CPUs to use.OCI_USERNAME
: The edge registry username.OCI_PASSWORD
: The edge registry password or token.PIPELINE_URL
: The published pipeline URL.Using our sample environment, here’s sample deployment using Docker with a computer vision ML model, the same used in the Wallaroo Use Case Tutorials Computer Vision: Retail tutorials.
Note the use of the -v ./data:/persist
option. This will store the one time authentication token stored in the EDGE_BUNDLE
mkdir ./data
docker run -p 8080:8080 \
-v ./data:/persist \
-e DEBUG=true -e OCI_REGISTRY={your registry server} \
-e EDGE_BUNDLE={edge_publish.docker_run_variables['EDGE_BUNDLE']} \
-e CONFIG_CPUS=4 \
-e OCI_USERNAME=oauth2accesstoken \
-e OCI_PASSWORD={registry token here} \
-e PIPELINE_URL={your registry server}/pipelines/yolo8demonstration:bf70eaf7-8c11-4b46-b751-916a43b1a555 \
{your registry server}/engine:v2023.3.0-main-3707
For users who prefer to use docker compose
, the following sample compose.yaml
file is used to launch the Wallaroo Edge pipeline. This is the same used in the Wallaroo Use Case Tutorials Computer Vision: Retail tutorials.
The volumes
settings allows for persistent volumes to store the session information. Without it, the one-time authentication token included in the EDGE_BUNDLE
settings would have to be regenerated.
services:
engine:
image: {Your Engine URL}
volumes:
- ./data:/persist
ports:
- 8080:8080
environment:
EDGE_BUNDLE: abcdefg
PIPELINE_URL: {Your Pipeline URL}
OCI_REGISTRY: {Your Edge Registry URL}
OCI_USERNAME: {Your Registry Username}
OCI_PASSWORD: {Your Token or Password}
CONFIG_CPUS: 4
For example:
services:
engine:
image: sample-registry.com/engine:v2023.3.0-main-3707
ports:
- 8080:8080
environment:
PIPELINE_URL: sample-registry.com/pipelines/yolo8demonstration:bf70eaf7-8c11-4b46-b751-916a43b1a555
OCI_REGISTRY: sample-registry.com
OCI_USERNAME: _json_key_base64
OCI_PASSWORD: abc123
CONFIG_CPUS: 4
The deployment and undeployment is then just a simple docker compose up
and docker compose down
. The following shows an example of deploying the Wallaroo edge pipeline using docker compose
.
docker compose up
[+] Running 1/1
✔ Container yolo8demonstration-engine-1 Recreated 0.5s
Attaching to yolo8demonstration-engine-1
yolo8demonstration-engine-1 | Wallaroo Engine - Standalone mode
yolo8demonstration-engine-1 | Login Succeeded
yolo8demonstration-engine-1 | Fetching manifest and config for pipeline: sample-registry.com/pipelines/yolo8demonstration:bf70eaf7-8c11-4b46-b751-916a43b1a555
yolo8demonstration-engine-1 | Fetching model layers
yolo8demonstration-engine-1 | digest: sha256:c6c8869645962e7711132a7e17aced2ac0f60dcdc2c7faa79b2de73847a87984
yolo8demonstration-engine-1 | filename: c6c8869645962e7711132a7e17aced2ac0f60dcdc2c7faa79b2de73847a87984
yolo8demonstration-engine-1 | name: yolov8n
yolo8demonstration-engine-1 | type: model
yolo8demonstration-engine-1 | runtime: onnx
yolo8demonstration-engine-1 | version: 693e19b5-0dc7-4afb-9922-e3f7feefe66d
yolo8demonstration-engine-1 |
yolo8demonstration-engine-1 | Fetched
yolo8demonstration-engine-1 | Starting engine
yolo8demonstration-engine-1 | Looking for preexisting `yaml` files in //modelconfigs
yolo8demonstration-engine-1 | Looking for preexisting `yaml` files in //pipelines
Published pipelines can be deployed through the use of helm charts.
Helm deployments take up to two steps - the first step is in retrieving the required values.yaml
and making updates to override.
Kubernetes provides persistent volume support, so no settings are required.
helm pull oci://{published.helm_chart_url} --version {published.helm_chart_version}
tgz
file and copy the values.yaml
and copy the values used to edit engine allocations, etc. The following are required for the deployment to run:ociRegistry:
registry: {your registry service}
username: {registry username here}
password: {registry token here}
Store this into another file, suc as local-values.yaml
.
wallaroo-edge-pipeline
would be:kubectl create -n wallaroo-edge-pipeline
Deploy the helm
installation with helm install
through one of the following options:
Specify the tgz
file that was downloaded and the local values file. For example:
helm install --namespace {namespace} --values {local values file} {helm install name} {tgz path}
Specify the expended directory from the downloaded tgz
file.
helm install --namespace {namespace} --values {local values file} {helm install name} {helm directory path}
Specify the Helm Pipeline Helm Chart and the Pipeline Helm Version.
helm install --namespace {namespace} --values {local values file} {helm install name} oci://{published.helm_chart_url} --version {published.helm_chart_version}
Once deployed, the DevOps engineer will have to forward the appropriate ports to the svc/engine-svc
service in the specific pipeline. For example, using kubectl port-forward
to the namespace ccfraud
that would be:
kubectl port-forward svc/engine-svc -n ccfraud01 8080 --address 0.0.0.0`
The following code segment generates a docker run
template based on the previously published pipeline. Replace the $REGISTRYURL
, $REGISTRYUSERNAME
, and $REGISTRYPASSWORD
to match the OCI Registry being used.
docker_deploy = f'''
docker run -p 8080:8080 \\
-v ./data:/persist \\
-e DEBUG=true \\
-e OCI_REGISTRY=$REGISTRYURL \\
-e EDGE_BUNDLE={edge_publish.docker_run_variables['EDGE_BUNDLE']} \\
-e CONFIG_CPUS=1 \\
-e OCI_USERNAME=$REGISTRYUSERNAME \\
-e OCI_PASSWORD=$REGISTRYPASSWORD \\
-e PIPELINE_URL={edge_publish.pipeline_url} \\
{edge_publish.engine_url}
'''
print(docker_deploy)
docker run -p 8080:8080 \
-v ./data:/persist \
-e DEBUG=true \
-e OCI_REGISTRY=$REGISTRYURL \
-e EDGE_BUNDLE=ZXhwb3J0IEJVTkRMRV9WRVJTSU9OPTEKZXhwb3J0IEVER0VfTkFNRT1lZGdlLXN1bW1hcml6YXRpb24tZGVtby1hcm0KZXhwb3J0IEpPSU5fVE9LRU49MTlkMGE4NzAtNTgyYy00YWExLWE5YjAtMWQxMTQ4MWI4MWRjCmV4cG9ydCBPUFNDRU5URVJfSE9TVD1kb2MtdGVzdC5lZGdlLndhbGxhcm9vY29tbXVuaXR5Lm5pbmphCmV4cG9ydCBQSVBFTElORV9VUkw9Z2hjci5pby93YWxsYXJvb2xhYnMvZG9jLXNhbXBsZXMvcGlwZWxpbmVzL2xsbS1lZGdlLXN1bW1hcml6YXRpb246MWM4ZDA1ODYtZjNmZi00NTNjLTgyYTktMTQ2MDI4MzBmOTdmCmV4cG9ydCBXT1JLU1BBQ0VfSUQ9OA== \
-e CONFIG_CPUS=1 \
-e OCI_USERNAME=$REGISTRYUSERNAME \
-e OCI_PASSWORD=$REGISTRYPASSWORD \
-e PIPELINE_URL=ghcr.io/wallaroolabs/doc-samples/pipelines/llm-edge-summarization:1c8d0586-f3ff-453c-82a9-14602830f97f \
ghcr.io/wallaroolabs/doc-samples/engines/proxy/wallaroo/ghcr.io/wallaroolabs/standalone-mini:v2023.4.0-4103
Once deployed, we can check the pipelines and models available. We’ll use a curl
command, but any HTTP based request will work the same way.
The endpoint /pipelines
returns:
Running
, or Error
if there are any issues.curl localhost:8080/pipelines
{"pipelines":[{"id":"yolo8demonstration","status":"Running"}]}
The following example uses the host localhost
. Replace with your own host name of your Edge deployed pipeline.
!curl workshop-hf-summarizer-demo.eastus.cloudapp.azure.com:8080/pipelines
{"pipelines":[{"id":"hf-summarizer-standard","status":"Running"}]}
The endpoint /models
returns a List of models with the following fields:
{"models":[{"name":"yolov8n","sha":"3ed5cd199e0e6e419bd3d474cf74f2e378aacbf586e40f24d1f8c89c2c476a08","status":"Running","version":"7af40d06-d18f-4b3f-9dd3-0a15248f01c8"}]}
The following example uses the host localhost
. Replace with your own host name of your Edge deployed pipeline.
!curl workshop-hf-summarizer-demo.eastus.cloudapp.azure.com:8080/models
{"models":[{"name":"hf-summarizer-standard","sha":"ee71d066a83708e7ca4a3c07caf33fdc528bb000039b6ca2ef77fa2428dc6268","status":"Running","version":"7dbae7b4-20d0-40f7-a3f5-eeabdd77f418"}]}
The inference endpoint takes the following pattern:
/pipelines/{pipeline-name}
: The pipeline-name
is the same as returned from the /pipelines
endpoint as id
.Wallaroo inference endpoint URLs accept the following data inputs through the Content-Type
header:
Content-Type: application/vnd.apache.arrow.file
: For Apache Arrow tables.Content-Type: application/json; format=pandas-records
: For pandas DataFrame in record format.Once deployed, we can perform an inference through the deployment URL.
The endpoint returns Content-Type: application/json; format=pandas-records
by default with the following fields:
null
if the input may be too long for a proper return.Once deployed, we can perform an inference through the deployment URL. We’ll assume we’re running the inference request through the localhost and submitting the local file ./data/dogbike.df.json
. Note that our inference endpoint is pipelines/yolo8demonstration
- the same as our pipeline name.
The following example demonstrates sending an inference request to the edge deployed pipeline and storing the results in a pandas DataFrame in record format. The results can then be exported to other processes to render the detected images or other use cases.
!curl workshop-hf-summarizer-demo.eastus.cloudapp.azure.com:8080/pipelines/hf-summarizer-standard \
-H "Content-Type: application/json; format=pandas-records" \
--data @./data/llm-summarization/test_summarization.df.json
[{"check_failures":[],"elapsed":[310666674,4294967295],"model_name":"hf-summarizer-standard","model_version":"7dbae7b4-20d0-40f7-a3f5-eeabdd77f418","original_data":null,"outputs":[{"String":{"data":["LinkedIn is a business and employment-focused social media platform that works through websites and mobile apps. It launched on May 5, 2003. LinkedIn allows members (both workers and employers) to create profiles and connect with each other in an online social network which may represent real-world professional relationships."],"dim":[1,1],"v":1}}],"pipeline_name":"hf-summarizer-standard","shadow_data":{},"time":1701815846451}]