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

mldock hero image

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. Create an empty directory
mkdir my_ml_container
  1. Initialize or create your first container

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

mldock container 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.8.6.tar.gz (78.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mldock-0.8.6-py3-none-any.whl (110.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mldock-0.8.6.tar.gz
  • Upload date:
  • Size: 78.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for mldock-0.8.6.tar.gz
Algorithm Hash digest
SHA256 6b6afd3c2ab3296a8fa5eaba2673e97e9fd05de4f35b5687dc2b3ae3208e7fb2
MD5 752acda3f9eaf2f32768dce583a47784
BLAKE2b-256 68c0dc1403694feeb6265c29caadf4dc6c777733eaa43cc8ce1aa37eba72e558

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mldock-0.8.6-py3-none-any.whl
  • Upload date:
  • Size: 110.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

File hashes

Hashes for mldock-0.8.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c41576ededb2823e06a38aa866c893df4920ceddef1be42d13a6fc3c363368cd
MD5 2af3a959a8399000affc0fb64c3fe08d
BLAKE2b-256 5a95c347238c6e824cc50ca95539ad88f4ee5d75a8f68d7eec709f5573e13835

See more details on using hashes here.

Supported by

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