MLflow Google Cloud Vertex AI integration package
Project description
MLflow plugin for Google Cloud Vertex AI
Installation
python3 -m pip install google_cloud_mlflow
Deployment plugin usage
Command-line
Create deployment
mlflow deployments create --target google_cloud --name "deployment name" --model-uri "models:/mymodel/mymodelversion" --config destination_image_uri="gcr.io/<repo>/<path>"
List deployments
mlflow deployments list --target google_cloud
Get deployment
mlflow deployments get --target google_cloud --name "deployment name"
Delete deployment
mlflow deployments delete --target google_cloud --name "deployment name"
Update deployment
mlflow deployments update --target google_cloud --name "deployment name" --model-uri "models:/mymodel/mymodelversion" --config destination_image_uri="gcr.io/<repo>/<path>"
Predict
mlflow deployments predict --target google_cloud --name "deployment name" --input-path "inputs.json" --output-path "outputs.json
Get help
mlflow deployments help --target google_cloud
Python
from mlflow import deployments
client = deployments.get_deploy_client("google_cloud")
# Create deployment
model_uri = "models:/mymodel/mymodelversion"
deployment = client.create_deployment(
name="deployment name",
model_uri=model_uri,
# Config is optional
config=dict(
# Deployed model config
machine_type="n1-standard-2",
min_replica_count=None,
max_replica_count=None,
accelerator_type=None,
accelerator_count=None,
service_account=None,
explanation_metadata=None, # JSON string
explanation_parameters=None, # JSON string
# Model container image building config
destination_image_uri=None,
timeout=None,
# Model deployment config
sync="true",
# Endpoint config
description=None,
# Vertex AI config
project=None,
location=None,
experiment=None,
experiment_description=None,
staging_bucket=None,
# List deployments
deployments = client.list_deployments()
# Get deployment
deployments = client.get_deployment(name="deployment name")
# Delete deployment
deployment = client.delete_deployment(name="deployment name")
# Update deployment
deployment = client.create_deployment(
name="deployment name",
model_uri=model_uri,
# Config is optional
config=dict(...),
)
# Predict
import pandas
df = pandas.DataFrame([
{"a": 1,"b": 2,"c": 3},
{"a": 4,"b": 5,"c": 6}
])
predictions = client.predict("deployment name", df)
Model Registry plugin usage
Set the MLflow Model Registry URI to a directory in some Google Cloud Storage bucket, then log models using mlflow.log_model
as usual.
mlflow.set_registry_uri("gs://<bucket>/models/")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
google_cloud_mlflow-0.0.3.tar.gz
(17.3 kB
view hashes)
Built Distribution
Close
Hashes for google_cloud_mlflow-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9addc781a895f9b3b983e1265696c86ad9a6ad22dda4df8de3343b93d07ad600 |
|
MD5 | 5ed14b14c931a4fc9a70f90b3ff53224 |
|
BLAKE2b-256 | f9b0792396a87ae669159c5e623624d01c1c72673b603b02d7b70ce655f81d52 |
Close
Hashes for google_cloud_mlflow-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 364487b77ccc623ea3f6e71906653cd7c683d88838bd188c7c59d9d581b4d586 |
|
MD5 | 6b0e1b1e709332d65bce05e3ad731097 |
|
BLAKE2b-256 | 6cdf97b025f9424f8c147d835da8faba20000977b49c8300df43b62db7eb39b7 |