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

feat: mlserver-huggingface rock integration #164

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/templates/configmap.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ data:
"HUGGINGFACE_SERVER": {
"protocols" : {
"v2": {
"image": "seldonio/mlserver",
"defaultImageVersion": "1.2.0-huggingface"
"image": "docker.io/charmedkubeflow/mlserver-huggingface_1.2.4_22.04_1_amd64",
"defaultImageVersion": "1.2.4_22.04_1"
}
}
},
Expand Down
20 changes: 20 additions & 0 deletions tests/assets/crs/huggingface.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# https://github.com/SeldonIO/MLServer/blob/master/docs/examples/huggingface/README.md
apiVersion: machinelearning.seldon.io/v1
kind: SeldonDeployment
metadata:
name: transformer
spec:
protocol: v2
predictors:
- graph:
name: classifier
implementation: HUGGINGFACE_SERVER
parameters:
- name: task
type: STRING
value: text-generation
- name: pretrained_model
type: STRING
value: distilgpt2
name: default
replicas: 1
35 changes: 35 additions & 0 deletions tests/integration/test_seldon_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,37 @@ async def test_build_and_deploy(ops_test: OpsTest):
{"instances": [1.0, 2.0, 5.0]},
{"predictions": [2.5, 3, 4.5]},
),
(
"HUGGINGFACE_SERVER",
"huggingface.yaml",
"v2/models/classifier/infer",
{
"inputs": [
{
"name": "args",
"shape": [1],
"datatype": "BYTES",
"data": ["this is a test"],
}
],
},
{
"model_name": "classifier",
"model_version": "v1",
"id": "None",
"parameters": {},
"outputs": [
{
"name": "output",
"shape": [1, 1],
"datatype": "BYTES",
"parameters": {"content_type": "str"},
# 'data' needs to be reset because GPT returns different results every time
"data": "None",
}
],
},
),
],
)
@pytest.mark.asyncio
Expand Down Expand Up @@ -252,6 +283,10 @@ async def test_seldon_predictor_server(
if "id" in response.keys():
response["id"] = "None"

# reset data for HUGGINGFACE_SERVER because GPT inference returns different data every time
if server_name == "HUGGINGFACE_SERVER":
response["outputs"][0]["data"] = "None"

# for 'seldon' protocol update test data with correct predictor server image
if protocol == "seldon":
# retrieve predictor server image from configmap to implicitly verify that it matches
Expand Down