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(docs): [SCv2] Add a section about loading custom HuggingFace models from Seldon CLI #5106

Conversation

vtaskow
Copy link
Contributor

@vtaskow vtaskow commented Aug 23, 2023

What this PR does / why we need it:
Following #5103, we need a demo of how our users might use the Seldon CLI to load custom HuggingFace models and make predictions.

Testing

  • created a local file with the following yaml contents(the same as the added file in this PR)
apiVersion: mlops.seldon.io/v1alpha1
kind: Model
metadata:
  name: custom-text-gen
spec:
  storageUri: "gs://seldon-models/scv2/samples/mlserver_1.3.5/custom-text-generation-huggingface"
  requirements:
    - huggingface
  memory: 3Gi
  • ran seldon model load -f seldon-model.yaml and seldon model status custom-text-gen | jq
{
  "modelName": "custom-text-gen",
  "versions": [
    {
      "version": 1,
      "serverName": "mlserver",
      "kubernetesMeta": {},
      "modelReplicaState": {
        "0": {
          "state": "Available",
          "lastChangeTimestamp": "2023-08-29T16:25:07.815102498Z"
        }
      },
      "state": {
        "state": "ModelAvailable",
        "availableReplicas": 1,
        "lastChangeTimestamp": "2023-08-29T16:25:07.815102498Z"
      },
      "modelDefn": {
        "meta": {
          "name": "custom-text-gen",
          "kubernetesMeta": {}
        },
        "modelSpec": {
          "uri": "gs://seldon-models/scv2/samples/mlserver_1.3.5/custom-text-generation-huggingface",
          "requirements": [
            "huggingface"
          ],
          "memoryBytes": "3221225472"
        },
        "deploymentSpec": {
          "replicas": 1
        }
      }
    }
  ]
}
  • inferred correctly by running seldon model infer custom-text-gen \ '{"inputs": [{"name": "args","shape": [1],"datatype": "BYTES","data": ["Once upon a time in a galaxy far away"]}]}'
  '{"inputs": [{"name": "args","shape": [1],"datatype": "BYTES","data": ["Once upon a time in a galaxy far away"]}]}'
{
	"model_name": "custom-text-gen_1",
	"model_version": "1",
	"id": "fad1b559-4181-42d9-ab61-86d1092bb7e1",
	"parameters": {},
	"outputs": [
		{
			"name": "output",
			"shape": [
				1,
				1
			],
			"datatype": "BYTES",
			"parameters": {
				"content_type": "hg_jsonlist"
			},
			"data": [
				"{\"generated_text\": \"Once upon a time in a galaxy far away the universe was never like this. There were no planets, but only small ones, and these little planets would grow to be a bit larger than life. Some of these planets have small civilizations, but the\"}"
			]
		}
	]
}
  • ran seldon model unload custom-text-gen
{
  "modelName": "custom-text-gen",
  "versions": [
    {
      "version": 1,
      "serverName": "mlserver",
      "kubernetesMeta": {},
      "modelReplicaState": {
        "0": {
          "state": "Unloaded",
          "lastChangeTimestamp": "2023-08-29T16:29:09.304450147Z"
        }
      },
      "state": {
        "state": "ModelTerminated",
        "lastChangeTimestamp": "2023-08-29T16:29:09.304450147Z"
      },
      "modelDefn": {
        "meta": {
          "name": "custom-text-gen",
          "kubernetesMeta": {}
        },
        "modelSpec": {
          "uri": "gs://seldon-models/scv2/samples/mlserver_1.3.5/custom-text-generation-huggingface",
          "requirements": [
            "huggingface"
          ],
          "memoryBytes": "3221225472"
        },
        "deploymentSpec": {
          "replicas": 1
        }
      }
    }
  ],
  "deleted": true
}

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@vtaskow vtaskow changed the title Add docs for usage of Seldon CLI to load custom HF models feat(docs): [SCv2] Add section about loading custom HuggingFace models from Seldon CLI Aug 23, 2023
@vtaskow vtaskow marked this pull request as ready for review August 23, 2023 15:41
@vtaskow vtaskow self-assigned this Aug 23, 2023
@vtaskow vtaskow changed the title feat(docs): [SCv2] Add section about loading custom HuggingFace models from Seldon CLI feat(docs): [SCv2] Add a section about loading custom HuggingFace models from Seldon CLI Aug 23, 2023
Copy link
Contributor

@adriangonz adriangonz left a comment

Choose a reason for hiding this comment

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

👍

@vtaskow vtaskow merged commit 564a2cd into SeldonIO:v2 Aug 29, 2023
7 of 8 checks passed
adriangonz pushed a commit that referenced this pull request Aug 31, 2023
…els from Seldon CLI (#5106)

* Add docs for usage of Seldon CLI to load custom HF models

* Update GCS location to custom HF model
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.

2 participants