Skip to main content

A docker tool that helps put machine learning in places that empower ml developers

Project description

MLDOCK

A docker tool that helps put machine learning in places that empower ml developers

PyPI CI Upload Python Package

mldock header

What is MLDOCK?

MLDOCK builds in conveniences and the power of docker and frames it around the core machine learning tasks related to production.

As a tool this means MLDOCK's goals are:

  • Provide tooling to improve the ML development workflow. ✅
  • Enable portability of ml code betwen platforms and vendors (Sagemaker, AI Platform, Kubernetes, other container services). ✅
  • Lower the barrier to entry by developing containers from templates. ✅
  • Be ready out the box, using templates to get you started quickly. Bring only your code. ✅
  • For any ML frameworks, runs in any orchestrator and on any cloud. (as long as it integrates with docker) ✅

What it is not:

  • Service orchestrator ❌
  • Training Scheduler ❌
  • Hyperparameter tuner ❌
  • Experiment Tracking ❌

Inspired by Sagify, Sagemaker Training Toolkit and Amazon Sagemaker.

Getting Started

Set up your environment

  1. (Optional) Use virtual environment to manage dependencies.
  2. Install dotenv easily configure environment.
pip install --user python-dotenv[cli]

note: dotenv allows configuring of environment through the .env file. MLDOCK uses ENVIRONMENT VARIABLES in the environment to find your DOCKER_HOST, DOCKERHUB credentials and even AWS/GCP credentials.

  1. Create an .env with the following:
# for windows and if you are using WSL1
DOCKER_HOST=tcp://127.0.0.1

# for WSL2 and linux (this is default and should work out of the box)
# but for consistency, set this dockerhost

DOCKER_HOST=unix://var/run/docker.sock

note: Now to switch environments just use dotenv as follows:

dotenv -f "/path/to/.env" run mldock local build --dir <my-project-path>

Overview of MLDOCK command line

The MLDOCK command line utility provides a set of commands to streamline the machine learning container image development process. The commands are grouped in to 3 functionality sets, namely:

Command Group Description
container A set of commands that support creating new containers, initialize and update containers. Also, provides commands for created new MLDOCK supported templates from previously built container images.
local A set of commands to use during the development phase. Creating your trainer, prediction scripts and debugging the execution of scripts.
registry A set of tools to help you push, pull and interact with image registries.

Create your first container image project

  1. Install MLDOCK

The pip install is the only supported package manager at present. It is recommended that you use an environment manager, either virtualenv or conda will work.

pip install mldock[cli]
  1. Setup local config for the mldock cli

This command sets up mldock cli with some nice to have defaults. It may even prompt you for some set up.

mldock configure init
  1. Initialize or create your first container

You will see a some of prompts to set up container.

mldock project init --dir my_ml_container

note:

  • Just hit Return/Enter to accept all the defaults.
  1. Build your container image locally
mldock local build --dir my_ml_container
  1. Run your training locally
mldock local train --dir my_ml_container
  1. Run your training locally
mldock local deploy --dir my_ml_container

Putting your model in the cloud

Push to Dockerhub

  1. Add the following to .env
DOCKERHUB_USERNAME=<your/user/name>
DOCKERHUB_PASSWORD=<your/dockerhub/password>
DOCKERHUB_REGISTRY=https://index.docker.io/v1/
DOCKERHUB_REPO=<your/user/repo/name>
  1. Push your container to dockerhub
mldock registry push --dir my_ml_container --provider dockerhub --build

note: The flags allow you to stipulate configuration changes in the command. --build says build the image before pushing. This is required initially since the dockerhub registry will prefix your container name. --provider tells MLDOCK to authenticate to dockerhub and push the container there.

hint In addition to DockerHub, both AWS ECR & GCP GCR are also supported.

helpful tips

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mldock-0.9.2.tar.gz (69.7 kB view details)

Uploaded Source

Built Distribution

mldock-0.9.2-py3-none-any.whl (109.7 kB view details)

Uploaded Python 3

File details

Details for the file mldock-0.9.2.tar.gz.

File metadata

  • Download URL: mldock-0.9.2.tar.gz
  • Upload date:
  • Size: 69.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for mldock-0.9.2.tar.gz
Algorithm Hash digest
SHA256 4f96a1a266a268e2aca4f781a6bbfd488110430cb1a8e20a2c59813623dd7b37
MD5 ae8d71fe0344e120314a360000e225d6
BLAKE2b-256 04a7290fd243f44dc171733c89685bb79b6da0497f303350c30068be6156ae64

See more details on using hashes here.

File details

Details for the file mldock-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: mldock-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 109.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.12

File hashes

Hashes for mldock-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 049a81f32082f01e2a805cac0d532799ec8d44d0425947c1332e4020329f6b49
MD5 7f398b155cce7be96485df2d3ec60e98
BLAKE2b-256 2a65853d963f4bd9763e4211804fae9a8fa74b8f09186fbe76c86d748d49a8d5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page