Wallaroo Edge Hugging Face LLM Summarization Deployment Demonstration

A demonstration on publishing a Hugging Face Summarization model for edge deployment via the Wallaroo SDK.

The following tutorial is available on the Wallaroo Github Repository.

Summarization Text Edge Deployment Demonstration

This notebook will walk through building a summarization text pipeline in Wallaroo, deploying it to the local cluster for testing, and then publishing it for edge deployment.

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 folder before beginning this demonstration.

model-auto-conversion_hugging-face_complex-pipelines_hf-summarisation-bart-large-samsun.zip (1.4 GB)

This demonstration performs the following:

  1. As a Data Scientist in Wallaroo Ops:
    1. Upload a computer vision model to Wallaroo, deploy it in a Wallaroo pipeline, then perform a sample inference.
    2. Publish the pipeline to an Open Container Initiative (OCI) Registry service. This is configured in the Wallaroo instance. See Edge Deployment Registry Guide for details on adding an OCI Registry Service to Wallaroo as the Edge Deployment Registry. This demonstration uses a GitHub repository - see Introduction to GitHub Packages for setting up your own package repository using GitHub, which can then be used with this tutorial.
    3. View the pipeline publish details.
  2. As a DevOps Engineer in a remote aka edge device:
    1. Deploy the published pipeline as a Wallaroo Inference Server. This example will use Docker.
    2. Perform a sample inference through the Wallaroo Inference Server with the same data used in the data scientist example.

References

Data Scientist Pipeline Publish Steps

Load Libraries

The first step is to import the libraries used in this notebook.

import wallaroo
from wallaroo.object import EntityNotFoundError

import pyarrow as pa
import pandas as pd
import time

# used to display dataframe information without truncating
from IPython.display import display
pd.set_option('display.max_colwidth', None)
pd.set_option('display.max_columns', None)

Connect to the Wallaroo Instance through the User Interface

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()

Create a New Workspace

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, a random 4 character prefix will be added to the workspace, pipeline, and model. Feel free to set suffix='' if this is not required.

workspace_name = f'edge-hf-summarization'
pipeline_name = 'edge-hf-summarization'
model_name = 'hf-summarization'
model_file_name = './models/model-auto-conversion_hugging-face_complex-pipelines_hf-summarisation-bart-large-samsun.zip'
workspace = wl.get_workspace(name=workspace_name, create_if_not_exist=True)

wl.set_current_workspace(workspace)
{'name': 'edge-hf-summarization', 'id': 1671, 'archived': False, 'created_by': '7d603858-88e0-472e-8f71-e41094afd7ec', 'created_at': '2025-05-16T16:26:15.723378+00:00', 'models': [], 'pipelines': []}

Configure PyArrow Schema

This is required for non-native runtimes for models deployed to Wallaroo.

You can find more info on the available inputs under TextSummarizationInputs or under the official source code from 🤗 Hugging Face.

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()),
])

Upload the Model

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 HuggingFace format, which is specified in the framework parameter. The input and output schemas are included as part of the model upload. For more information, see Wallaroo SDK Essentials Guide: Model Uploads and Registrations: Hugging Face.

model = wl.upload_model(model_name, 
                        model_file_name, 
                        framework=wallaroo.framework.Framework.HUGGING_FACE_SUMMARIZATION, 
                        input_schema=input_schema, 
                        output_schema=output_schema,
                        convert_wait=False
                        )
model
Namehf-summarization
Version4c724404-a130-442c-9633-47b270067aaa
File Namemodel-auto-conversion_hugging-face_complex-pipelines_hf-summarisation-bart-large-samsun.zip
SHAee71d066a83708e7ca4a3c07caf33fdc528bb000039b6ca2ef77fa2428dc6268
Statuspending_load_container
Image PathNone
Architecturex86
Accelerationnone
Updated At2025-16-May 16:27:12
Workspace id1671
Workspace nameedge-hf-summarization
while model.status() != "ready" and model.status() != "error":
    print(model.status())
    time.sleep(10)
print(model.status())
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
attempting_load_container
ready

Reserve Pipeline Resources

Before deploying an inference engine we need to tell wallaroo what resources it will need.
To do this we will use the wallaroo DeploymentConfigBuilder() and fill in the options listed below to determine what the properties of our inference engine will be.

We will be testing this deployment for an edge scenario, so the resource specifications are kept small – what’s the minimum needed to meet the expected load on the planned hardware.

  • cpus - 4 => allow the engine to use 4 CPU cores when running the neural net
  • memory - 8Gi => each inference engine will have 8 GB of memory, which is plenty for processing a single image at a time.
deployment_config = wallaroo.DeploymentConfigBuilder() \
    .cpus(0.25).memory('1Gi') \
    .sidekick_cpus(model, 4) \
    .sidekick_memory(model, "8Gi") \
    .build()

Simulated Edge Deployment

We will now deploy our pipeline into the current Kubernetes environment using the specified resource constraints. This is a “simulated edge” deploy in that we try to mimic the edge hardware as closely as possible.

pipeline = wl.build_pipeline(pipeline_name)
pipeline.clear()
pipeline.add_model_step(model)

pipeline.deploy(deployment_config=deployment_config, wait_for_status=False)
Deployment initiated for edge-hf-summarization. Please check pipeline status.
nameedge-hf-summarization
created2025-05-16 16:30:25.959276+00:00
last_updated2025-05-16 16:30:26.017436+00:00
deployedTrue
workspace_id1671
workspace_nameedge-hf-summarization
archx86
accelnone
tags
versionsf4ba80ab-778a-4970-bdce-8f1d39310416, fb13126a-02a9-4b4d-8976-6b675c070e8f
stepshf-summarization
publishedFalse
# check the pipeline status before performing an inference

while pipeline.status()['status'] != 'Running':
   time.sleep(15)
   display(pipeline.status()['status'])

pipeline.status()
'Starting'
'Starting'
'Starting'
'Starting'
'Running'
{'status': 'Running',
 'details': [],
 'engines': [{'ip': '10.4.2.58',
   'name': 'engine-684f588f6d-7vtf2',
   'status': 'Running',
   'reason': None,
   'details': [],
   'pipeline_statuses': {'pipelines': [{'id': 'edge-hf-summarization',
      'status': 'Running',
      'version': 'f4ba80ab-778a-4970-bdce-8f1d39310416'}]},
   'model_statuses': {'models': [{'model_version_id': 700,
      'name': 'hf-summarization',
      'sha': 'ee71d066a83708e7ca4a3c07caf33fdc528bb000039b6ca2ef77fa2428dc6268',
      'status': 'Running',
      'version': '4c724404-a130-442c-9633-47b270067aaa'}]}}],
 'engine_lbs': [{'ip': '10.4.2.59',
   'name': 'engine-lb-5f76cc9c94-bdjqg',
   'status': 'Running',
   'reason': None,
   'details': []}],
 'sidekicks': [{'ip': '10.4.8.3',
   'name': 'engine-sidekick-hf-summarization-700-8b847f7c6-5rrp2',
   'status': 'Running',
   'reason': None,
   'details': [],
   'statuses': '\n'}]}

Run Sample Inference

A single inference using sample input data is prepared below. We’ll run through it to verify the pipeline inference is working.

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
inputsreturn_textreturn_tensorsclean_up_tokenization_spaces
0LinkedIn (/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 moreTrueFalseFalse
deploy_url = pipeline._deployment._url()

headers = wl.auth.auth_header()

headers['Content-Type']='application/json; format=pandas-records'
# headers['Content-Type']='application/json; format=pandas-records'
headers['Accept']='application/json; format=pandas-records'

dataFile = './data/test_summarization.df.json'
!curl -X POST {deploy_url} \
     -H "Authorization:{headers['Authorization']}" \
     -H "Content-Type:{headers['Content-Type']}" \
     -H "Accept:{headers['Accept']}" \
     --data-binary @{dataFile}
[{"time":1747413364849,"in":{"clean_up_tokenization_spaces":false,"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","return_tensors":false,"return_text":true},"out":{"summary_text":"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."},"anomaly":{"count":0},"metadata":{"last_model":"{\"model_name\":\"hf-summarization\",\"model_sha\":\"ee71d066a83708e7ca4a3c07caf33fdc528bb000039b6ca2ef77fa2428dc6268\"}","pipeline_version":"f4ba80ab-778a-4970-bdce-8f1d39310416","elapsed":[1778419,5123862000],"dropped":[],"partition":"engine-684f588f6d-7vtf2"}}]

Undeploy the Pipeline

Just to clear up resources, we’ll undeploy the pipeline.

pipeline.undeploy()
Waiting for undeployment - this will take up to 45s .................................... ok
nameedge-hf-summarization
created2025-05-16 16:30:25.959276+00:00
last_updated2025-05-16 16:30:26.017436+00:00
deployedFalse
workspace_id1671
workspace_nameedge-hf-summarization
archx86
accelnone
tags
versionsf4ba80ab-778a-4970-bdce-8f1d39310416, fb13126a-02a9-4b4d-8976-6b675c070e8f
stepshf-summarization
publishedFalse

Publish the Pipeline for Edge Deployment

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).

Publish Example

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.

## This may still show an error status despite but if both containers show running it should be good to go
pipeline.publish(deployment_config)
Waiting for pipeline publish... It may take up to 600 sec.
....................... Published.
ID53
Pipeline Nameedge-hf-summarization
Pipeline Versionb04113e5-8d48-4163-a815-5160256885b3
StatusPublished
Workspace Id1671
Workspace Nameedge-hf-summarization
Edges
Engine URLsample.registry.example.com/uat/engines/proxy/wallaroo/ghcr.io/wallaroolabs/fitzroy-mini:v2025.1.0-main-6139
Pipeline URLsample.registry.example.com/uat/pipelines/edge-hf-summarization:b04113e5-8d48-4163-a815-5160256885b3
Helm Chart URLoci://sample.registry.example.com/uat/charts/edge-hf-summarization
Helm Chart Referencesample.registry.example.com/uat/charts@sha256:1f56b045abeb354b75f1cc9a84cddfe05d4c8f3b1ca4ffcb530d47420de68048
Helm Chart Version0.0.1-b04113e5-8d48-4163-a815-5160256885b3
Engine Config{'engine': {'resources': {'limits': {'cpu': 0.25, 'memory': '1Gi'}, 'requests': {'cpu': 0.25, 'memory': '1Gi'}, 'accel': 'none', 'arch': 'x86', 'gpu': False}}, 'engineAux': {'autoscale': {'type': 'none', 'cpu_utilization': 50.0}, 'images': {'hf-summarization-700': {'resources': {'limits': {'cpu': 4.0, 'memory': '8Gi'}, 'requests': {'cpu': 4.0, 'memory': '8Gi'}, 'accel': 'none', 'arch': 'x86', 'gpu': False}}}}}
User Images[]
Created Byjohn.hummel@wallaroo.ai
Created At2025-05-16 16:36:48.065704+00:00
Updated At2025-05-16 16:36:48.065704+00:00
Replaces
Docker Run Command
docker run \
    -p $EDGE_PORT:8080 \
    -e OCI_USERNAME=$OCI_USERNAME \
    -e OCI_PASSWORD=$OCI_PASSWORD \
    -e PIPELINE_URL=sample.registry.example.com/uat/pipelines/edge-hf-summarization:b04113e5-8d48-4163-a815-5160256885b3 \
    -e CONFIG_CPUS=1.0 --cpus=4.25 --memory=9g \
    sample.registry.example.com/uat/engines/proxy/wallaroo/ghcr.io/wallaroolabs/fitzroy-mini:v2025.1.0-main-6139

Note: Please set the EDGE_PORT, OCI_USERNAME, and OCI_PASSWORD environment variables.
Helm Install Command
helm install --atomic $HELM_INSTALL_NAME \
    oci://sample.registry.example.com/uat/charts/edge-hf-summarization \
    --namespace $HELM_INSTALL_NAMESPACE \
    --version 0.0.1-b04113e5-8d48-4163-a815-5160256885b3 \
    --set ociRegistry.username=$OCI_USERNAME \
    --set ociRegistry.password=$OCI_PASSWORD

Note: Please set the HELM_INSTALL_NAME, HELM_INSTALL_NAMESPACE, OCI_USERNAME, and OCI_PASSWORD environment variables.

List Published Pipeline

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).

wl.list_pipelines(workspace_name=workspace_name)
namecreatedlast_updateddeployedworkspace_idworkspace_namearchacceltagsversionsstepspublished
edge-hf-summarization2025-16-May 16:30:252025-16-May 16:36:47False1671edge-hf-summarizationx86noneb04113e5-8d48-4163-a815-5160256885b3, f4ba80ab-778a-4970-bdce-8f1d39310416, fb13126a-02a9-4b4d-8976-6b675c070e8fhf-summarizationTrue

List Publishes from a Pipeline

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.

List Publishes Parameters

N/A

List Publishes Returns

A List of the following fields:

FieldTypeDescription
idintegerNumerical Wallaroo id of the published pipeline.
pipeline_version_idintegerNumerical Wallaroo id of the pipeline version published.
engine_urlstringThe URL of the published pipeline engine in the edge registry.
pipeline_urlstringThe URL of the published pipeline in the edge registry.
created_bystringThe email address of the user that published the pipeline.
Created AtDateTimeWhen the published pipeline was created.
Updated AtDateTimeWhen the published pipeline was updated.
pipeline.publishes()
idPipeline NamePipeline VersionWorkspace IdWorkspace NameEdgesEngine URLPipeline URLCreated ByCreated AtUpdated At
53edge-hf-summarizationb04113e5-8d48-4163-a815-5160256885b31671edge-hf-summarizationsample.registry.example.com/uat/engines/proxy/wallaroo/ghcr.io/wallaroolabs/fitzroy-mini:v2025.1.0-main-6139sample.registry.example.com/uat/pipelines/edge-hf-summarization:b04113e5-8d48-4163-a815-5160256885b3john.hummel@wallaroo.ai2025-16-May 16:36:482025-16-May 16:36:48

DevOps - Pipeline Edge Deployment

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. For our example, we will use the docker run command output during the pipeline publish.

Edge Deployed Pipeline API Endpoints

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:

  • id (String): The name of the pipeline.
  • status (String): The status as either Running, or Error if there are any issues.
curl localhost:8080/pipelines
{"pipelines":[{"id":"edge-cv-retail","status":"Running"}]}
!curl testboy.local:8080/pipelines
{"pipelines":[{"id":"edge-hf-summarization","status":"Running"}]}

The endpoint /models returns a List of models with the following fields:

  • name (String): The model name.
  • sha (String): The sha hash value of the ML model.
  • status (String): The status of either Running or Error if there are any issues.
  • version (String): The model version. This matches the version designation used by Wallaroo to track model versions in UUID format.
curl localhost:8080/models
{"models":[{"name":"resnet-50","sha":"c6c8869645962e7711132a7e17aced2ac0f60dcdc2c7faa79b2de73847a87984","status":"Running","version":"693e19b5-0dc7-4afb-9922-e3f7feefe66d"}]}
!curl testboy.local:8080/models
{"models":[{"name":"hf-summarization","version":"add06bd2-054e-4562-b25e-ee692c6e472c","sha":"ee71d066a83708e7ca4a3c07caf33fdc528bb000039b6ca2ef77fa2428dc6268","status":"Running"}]}

Edge Inference Endpoint

The inference endpoint takes the following pattern:

  • /pipelines/infer

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:

  • check_failures (List[Integer]): Whether any validation checks were triggered. For more information, see Wallaroo SDK Essentials Guide: Pipeline Management: Anomaly Testing.
  • elapsed (List[Integer]): A list of time in nanoseconds for:
    • [0] The time to serialize the input.
    • [1…n] How long each step took.
  • model_name (String): The name of the model used.
  • model_version (String): The version of the model in UUID format.
  • original_data: The original input data. Returns null if the input may be too long for a proper return.
  • outputs (List): The outputs of the inference result separated by data type, where each data type includes:
    • data: The returned values.
    • dim (List[Integer]): The dimension shape returned.
    • v (Integer): The vector shape of the data.
  • pipeline_name (String): The name of the pipeline.
  • shadow_data: Any shadow deployed data inferences in the same format as outputs.
  • time (Integer): The time since UNIX epoch.
import json
import requests
import pandas as pd

# set the content type and accept headers
headers = {
    'Content-Type': 'application/json; format=pandas-records'
}

# Submit arrow file
dataFile="./data/test_summarization.df.json"

data = json.load(open(dataFile))

host = 'http://testboy.local:8080'

deployurl = f'{host}/infer'

response = requests.post(
                    deployurl, 
                    headers=headers, 
                    json=data, 
                    verify=True
                )

# display(response)
display(pd.DataFrame(response.json()).loc[0, ['outputs']][0][0]['String']['data'][0])
'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.'