Skip to main content

ML Pipeline Generator

PyPI version

ML Pipeline Generator is a tool for generating end-to-end pipelines composed of GCP components so that users can easily migrate their local ML models onto GCP and start realizing the benefits of the Cloud quickly.

The following ML frameworks will be supported:

  1. TensorFlow (TF)
  2. Scikit-learn (SKL)
  3. XGBoost (XGB)

The following backends are currently supported for model training:

  1. Google Cloud AI Platform
  2. AI Platform Pipelines (managed Kubeflow Pipelines)

Installation

pip install ml-pipeline-gen

Setup

GCP credentials

gcloud auth login
gcloud auth application-default login
gcloud config set project [PROJECT_ID]

Enabling required APIs

The tool requires following Google Cloud APIs to be enabled:

  1. Compute Engine
  2. AI Platform Training and Prediction
  3. Cloud Storage

Enable the above APIs by following the links, or run the below command to enable the APIs for your project.

gcloud services enable ml.googleapis.com \
compute.googleapis.com \
storage-component.googleapis.com

Python environment

python3 -m venv venv
source ./venv/bin/activate
pip install ml-pipeline-gen

Kubeflow

Create a Kubeflow deployment using Cloud Marketplace. Follow these instructions to give the Kubeflow instance access to GCP services.

A future release will automate provisioning of KFP clusters and incorporate K8s Workload Identity for auth.

Cloud AI Platform Demo

This demo uses the scikit-learn model in examples/sklearn/model/sklearn_model.py to create a training module to run on CAIP. First, make a copy of the scikit-learn example.

cp -r examples/sklearn sklearn-demo
cd sklearn-demo

Create a config.yaml by using the config.yaml.example template. See the Input args section for details on the config parameters. Once the config file is filled out, run the demo.

python demo.py

Running this demo uses the config file to generate a trainer/ module that is compatible with CAIP.

KFP Demo

This demo uses the TensorFlow model in examples/kfp/model/tf_model.py to create a KubeFlow Pipeline (hosted on AI Platform Pipelines). First, make a copy of the kfp example.

cp -r examples/kfp kfp-demo
cd kfp-demo

Create a config.yaml by using the config.yaml.example template. See the Input args section for details on the config parameters. Once the config file is filled out, run the demo.

python demo.py

Running this demo uses the config file to generate a trainer/ module that is compatible with CAIP. It also generates orchestration/pipeline.py, which compiles a Kubeflow Pipeline.

Tests

The tests use unittest, Python's built-in unit testing framework. By running python -m unittest, the framework performs test discovery to find all tests within this project. Tests can be run on a more granular level by feeding a directory to test discover. Read more about unittest here.

python -m unittest

Input args

The following input args are included by default. Overwrite them by adding them as inputs in the config file.

Arg Description
train_path Dir or bucket containing train data.
eval_path Dir or bucket containing eval data.
model_dir Dir or bucket to save model files.
batch_size Number of rows of data to be fed into the model each iteration.
max_steps The maximum number of iterations to train the model for.
learning_rate Multiplier that controls how much the weights of our network are adjusted with respoect to the loss gradient.
export_format File format expected by the exported model at inference time.
save_checkpoints_steps Number of steps to run before saving a model checkpoint.
keep_checkpoint_max Number of model checkpoints to keep.
log_step_count_steps Number of steps to run before logging training performance.
eval_steps Number of steps to use to evaluate the model.
early_stopping_steps Number of steps with no loss decrease before stopping early.

Contribute

To modify the behavior of the library, install ml-pipeline-gen using:

pip install -e .

Metadata

Release files for ml-pipeline-gen 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ml-pipeline-gen 0.0.5
File Size Uploaded Provenance Actions
ml-pipeline-gen-0.0.5.tar.gz 21.4 kB Without provenance Details for ml-pipeline-gen-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ml-pipeline-gen 0.0.5
File Interpreter ABI Platform Actions
ml_pipeline_gen-0.0.5-py3-none-any.whl Python 3 none any Details for ml_pipeline_gen-0.0.5-py3-none-any.whl

Total release size: 58.4 kB

Release files / ml-pipeline-gen-0.0.5.tar.gz

Download URL ml-pipeline-gen-0.0.5.tar.gz
Size 21.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ad077b8841570f06cde49a3ced81d2d3c8716398dd586140b1ab7bdf19bbab6d
BLAKE2b-256 checksum
How to use checksums
0d5d0bbc3980e023c2caddfe41e5f55847ca8a95a6166eb1a2bf4108822f78f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

Release files / ml_pipeline_gen-0.0.5-py3-none-any.whl

Download URL ml_pipeline_gen-0.0.5-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17a7f08be66fc2d9836ad6c417abe24e2edb30e701dc15897f65f999a91235fc
BLAKE2b-256 checksum
How to use checksums
f866f032b3ba762d9f514620bceea509db4e07266e96db3cd11c930878680960
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.3

Security for ml-pipeline-gen 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page