Skip to content

hsml.predictor #

[source] Predictor #

Bases: DeployableComponent

Metadata object representing a predictor in Model Serving.

[source] id property #

Id of the predictor.

[source] name property writable #

Name of the predictor.

[source] version property #

Version of the predictor.

[source] description property writable #

Description of the predictor.

[source] model_name property writable #

Name of the model deployed by the predictor.

[source] model_path property writable #

Model path deployed by the predictor.

[source] model_version property writable #

Model version deployed by the predictor.

[source] model_framework property writable #

Model framework of the model to be deployed by the predictor.

[source] artifact_version property writable #

Artifact version deployed by the predictor.

Deprecated

Artifact versions are deprecated in favor of deployment versions.

[source] artifact_files_path property #

Path of the artifact files deployed by the predictor.

[source] artifact_path property #

Path of the model artifact deployed by the predictor. Resolves to /Projects/{project_name}/Models/{name}/{version}/Artifacts/{artifact_version}/{name}{version}.zip.

[source] model_server property #

Model server used by the predictor.

[source] serving_tool property writable #

Serving tool used to run the model server.

[source] script_file property writable #

Script file used to load and run the model.

[source] config_file property writable #

Model server configuration file passed to the model deployment.

It can be accessed via CONFIG_FILE_PATH environment variable from a predictor or transformer script. For LLM deployments without a predictor script, this file is used to configure the vLLM engine.

[source] inference_logger property writable #

Configuration of the inference logger attached to this predictor.

[source] transformer property writable #

Transformer configuration attached to the predictor.

[source] created_at property #

Created at date of the predictor.

[source] creator property #

Creator of the predictor.

[source] requested_instances property #

Total number of requested instances in the predictor.

[source] api_protocol property writable #

API protocol enabled in the predictor (e.g., HTTP or GRPC).

[source] environment property writable #

Name of the inference environment.

[source] project_namespace property writable #

Kubernetes project namespace.

[source] project_name property writable #

Name of the project the deployment belongs to.

[source] deploy #

deploy()

Create a deployment for this predictor and persists it in the Model Serving.

Example
import hopsworks

project = hopsworks.login()

# get Hopsworks Model Registry handle
mr = project.get_model_registry()

# retrieve the trained model you want to deploy
my_model = mr.get_model("my_model", version=1)

# get Hopsworks Model Serving handle
ms = project.get_model_serving()

my_predictor = ms.create_predictor(my_model)
my_deployment = my_predictor.deploy()

print(my_deployment.get_state())
RETURNS DESCRIPTION

Deployment. The deployment metadata object of a new or existing deployment.

[source] describe #

describe()

Print a JSON description of the predictor.