Name | h2o-mlops JSON |
Version |
1.4.2
JSON |
| download |
home_page | None |
Summary | Python client for H2O MLOps. |
upload_time | 2025-09-03 08:36:29 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | Apache v2 |
keywords |
h2o
mlops
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# An H2O MLOps Python Client
## Example
```
import h2o_mlops
import h2o_mlops.options as options
import h2o_mlops.types as types
```
First, we need to connect to MLOps. In the default case, the client detects credentials and configuration options from the environment.
```
mlops = h2o_mlops.Client()
```
Alternatively, you can initialize the client explicitly by passing the required parameters.
```
mlops = h2o_mlops.Client(
h2o_cloud_url=<H2O_CLOUD_URL>,
refresh_token=<REFRESH_TOKEN>,
ssl_cacert="/path/to/your/ca_certificate.pem", # If SSL is not needed, you can omit it.
)
```
Replace `<H2O_CLOUD_URL>` and `<REFRESH_TOKEN>` with your actual values.
### Everything Starts with a Workspace
A workspace is the main base of operations for most MLOps activities.
```
workspace = mlops.workspaces.create(name="demo")
```
```
mlops.workspaces.list(name="demo")
```
| name | uid
----+--------+--------------------------------------
0 | demo | 45e5a888-ec1f-4f9c-85ca-817465344b1f
You can also do `workspace = mlops.workspaces.get(uid=...)`.
### Upload an Experiment
```
experiment = workspace.experiments.create(
data="/path/to/your/model.zip",
name="experiment-from-client"
)
```
Some experiment attributes of interest.
```
experiment.uid
```
'e307aa9f-895f-4b07-9404-b0728d1b7f03'
Existing experiments can be viewed and retrieved.
```
workspace.experiments.list()
```
| name | uid | tags
----+------------------------+--------------------------------------+--------
0 | experiment-from-client | e307aa9f-895f-4b07-9404-b0728d1b7f03 |
You can also do `experiment = workspaces.experiments.get(uid=...)`.
### Create a Model
```
model = workspace.models.create(name="model-from-client")
```
Existing models can be viewed and retrieved.
```
workspace.models.list()
```
| name | uid
----+-------------------+--------------------------------------
0 | model-from-client | d18a677f-b800-4a4b-8642-0f59e202d225
You can also do `model = workspaces.models.get(uid=...)`.
### Register an Experiment to a Model
In order to deploy a model, it needs to have experiments registered to it.
```
model.register(experiment=experiment)
```
```
model.versions()
```
| version | experiment_uid
----+-----------+--------------------------------------
0 | 1 | e307aa9f-895f-4b07-9404-b0728d1b7f03
```
model.experiment(model_version="latest").name
```
'experiment-from-client'
### Deployment
#### What is needed for a single model deployment?
- workspace
- model
- scoring runtime
- security options
- name for deployment
We already have a `workspace` and `model`. Next we'll get the `scoring_runtime` for our model type, from the scoring runtime suggestions for the experiment to select the appropriate one.
```
model.experiment().scoring_runtimes
```
| name | artifact_type | uid
----+-------------------+-----------------+-------------------
0 | H2O-3 MOJO scorer | h2o3_mojo | h2o3_mojo_runtime
```
scoring_runtime = model.experiment().scoring_runtimes[0]
```
Now we can create a deployment.
```
deployment = workspace.deployments.create(
name="deployment-from-client",
composition_options=options.CompositionOptions(
model=model,
scoring_runtime=scoring_runtime,
),
security_options=options.SecurityOptions(
security_type=types.SecurityType.DISABLED,
),
)
deployment.wait_for_healthy()
deployment.state
```
'HEALTHY'
### Score
Once you have a deployment, you can score with it through the HTTP protocol.
```
scorer = deployment.scorer
scorer.score(
payload=scorer.sample_request(auth_value=...),
auth_value=...,
)
```
{'fields': ['C11.0', 'C11.1'],
'id': 'e307aa9f-895f-4b07-9404-b0728d1b7f03',
'score': [['0.49786656666743145', '0.5021334333325685']]}
Raw data
{
"_id": null,
"home_page": null,
"name": "h2o-mlops",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "h2o, mlops",
"author": null,
"author_email": "\"H2O.ai\" <support@h2o.ai>",
"download_url": null,
"platform": null,
"description": "# An H2O MLOps Python Client\n\n## Example\n\n```\nimport h2o_mlops\nimport h2o_mlops.options as options\nimport h2o_mlops.types as types\n```\n\nFirst, we need to connect to MLOps. In the default case, the client detects credentials and configuration options from the environment.\n\n```\nmlops = h2o_mlops.Client()\n```\n\nAlternatively, you can initialize the client explicitly by passing the required parameters.\n\n```\nmlops = h2o_mlops.Client(\n h2o_cloud_url=<H2O_CLOUD_URL>,\n refresh_token=<REFRESH_TOKEN>,\n ssl_cacert=\"/path/to/your/ca_certificate.pem\", # If SSL is not needed, you can omit it.\n)\n```\n\nReplace `<H2O_CLOUD_URL>` and `<REFRESH_TOKEN>` with your actual values.\n\n### Everything Starts with a Workspace\n\nA workspace is the main base of operations for most MLOps activities.\n\n```\nworkspace = mlops.workspaces.create(name=\"demo\")\n```\n\n```\nmlops.workspaces.list(name=\"demo\")\n```\n\n | name | uid\n ----+--------+--------------------------------------\n 0 | demo | 45e5a888-ec1f-4f9c-85ca-817465344b1f\n\nYou can also do `workspace = mlops.workspaces.get(uid=...)`.\n\n### Upload an Experiment\n\n```\nexperiment = workspace.experiments.create(\n data=\"/path/to/your/model.zip\",\n name=\"experiment-from-client\"\n)\n```\n\nSome experiment attributes of interest.\n\n```\nexperiment.uid\n```\n\n 'e307aa9f-895f-4b07-9404-b0728d1b7f03'\n\nExisting experiments can be viewed and retrieved.\n\n```\nworkspace.experiments.list()\n```\n\n | name | uid | tags\n ----+------------------------+--------------------------------------+--------\n 0 | experiment-from-client | e307aa9f-895f-4b07-9404-b0728d1b7f03 |\n\nYou can also do `experiment = workspaces.experiments.get(uid=...)`.\n\n### Create a Model\n\n```\nmodel = workspace.models.create(name=\"model-from-client\")\n```\n\nExisting models can be viewed and retrieved.\n\n```\nworkspace.models.list()\n```\n\n | name | uid\n ----+-------------------+--------------------------------------\n 0 | model-from-client | d18a677f-b800-4a4b-8642-0f59e202d225\n\nYou can also do `model = workspaces.models.get(uid=...)`.\n\n### Register an Experiment to a Model\n\nIn order to deploy a model, it needs to have experiments registered to it.\n\n```\nmodel.register(experiment=experiment)\n```\n\n```\nmodel.versions()\n```\n\n | version | experiment_uid\n ----+-----------+--------------------------------------\n 0 | 1 | e307aa9f-895f-4b07-9404-b0728d1b7f03\n\n```\nmodel.experiment(model_version=\"latest\").name\n```\n\n 'experiment-from-client'\n\n### Deployment\n\n#### What is needed for a single model deployment?\n- workspace\n- model\n- scoring runtime\n- security options\n- name for deployment\n\nWe already have a `workspace` and `model`. Next we'll get the `scoring_runtime` for our model type, from the scoring runtime suggestions for the experiment to select the appropriate one.\n\n```\nmodel.experiment().scoring_runtimes\n```\n\n | name | artifact_type | uid\n ----+-------------------+-----------------+-------------------\n 0 | H2O-3 MOJO scorer | h2o3_mojo | h2o3_mojo_runtime\n\n```\nscoring_runtime = model.experiment().scoring_runtimes[0]\n```\n\nNow we can create a deployment.\n\n```\ndeployment = workspace.deployments.create(\n name=\"deployment-from-client\",\n composition_options=options.CompositionOptions(\n model=model,\n scoring_runtime=scoring_runtime,\n ),\n security_options=options.SecurityOptions(\n security_type=types.SecurityType.DISABLED,\n ),\n)\n\ndeployment.wait_for_healthy()\n \ndeployment.state\n```\n\n 'HEALTHY'\n\n### Score\n\nOnce you have a deployment, you can score with it through the HTTP protocol.\n\n```\nscorer = deployment.scorer\n\nscorer.score(\n payload=scorer.sample_request(auth_value=...),\n auth_value=...,\n)\n```\n\n {'fields': ['C11.0', 'C11.1'],\n 'id': 'e307aa9f-895f-4b07-9404-b0728d1b7f03',\n 'score': [['0.49786656666743145', '0.5021334333325685']]}\n",
"bugtrack_url": null,
"license": "Apache v2",
"summary": "Python client for H2O MLOps.",
"version": "1.4.2",
"project_urls": {
"Changelog": "https://docs.h2o.ai/mlops/release-notes",
"Documentation": "https://docs.h2o.ai/mlops/py-client/overview"
},
"split_keywords": [
"h2o",
" mlops"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e137f3f73b49eec00d9d1ee49cab3ffa5bc82e79bdf0db2c694512df2c40a1d9",
"md5": "48521371efc46ee8741e17e94d5e5451",
"sha256": "b4c1b811be174af64ef2913d3838ed25ec321075166adb797c267d9cd56f9d33"
},
"downloads": -1,
"filename": "h2o_mlops-1.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "48521371efc46ee8741e17e94d5e5451",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 904339,
"upload_time": "2025-09-03T08:36:29",
"upload_time_iso_8601": "2025-09-03T08:36:29.550763Z",
"url": "https://files.pythonhosted.org/packages/e1/37/f3f73b49eec00d9d1ee49cab3ffa5bc82e79bdf0db2c694512df2c40a1d9/h2o_mlops-1.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-03 08:36:29",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "h2o-mlops"
}