Skip to main content

A tool to dockerize machine learning projects

Project description

DockerizeAsML

DockerizeAsML is a Python library that allows users to effortlessly dockerize an entire machine learning (ML) project with a single command-line instruction. It automatically recognizes ML model files in the project directory, generates an appropriate Dockerfile, and provides flexibility in configuration.

Installation

You can install DockerizeAsML using pip:

pip install dockerizeasml

Features

  • Automatic detection of common ML model file formats (pkl, h5, joblib, pt, pth, onnx, pickle)
  • Generation of a Dockerfile tailored to your ML project
  • Customizable entry point for your dockerized application
  • Flexible port configuration
  • Customizable Python version selection
  • Support for additional Python package installations
  • Easy-to-use command-line interface

Usage

To dockerize your ML project, navigate to your project's root directory and run:

dockerizeasml /path/to/your/ml/project

Advanced Usage

You can customize various aspects of the dockerization process:

dockerizeasml /path/to/your/ml/project --entry-point app.py --port 8080 --python-version 3.9 --extra-installs "nltk.downloader -d /usr/local/nltk_data wordnet omw" "pip install some-extra-package"
  • --entry-point: Specify the main Python script (default is app.py)
  • --port: Set the port to expose (default is 5000)
  • --python-version: Choose the Python version for the base image (default is 3.9)
  • --extra-installs: Add additional installation commands (default includes NLTK data download)

How it works

  1. DockerizeAsML scans your project directory for ML model files.

  2. It analyzes Python scripts to detect potential model variable names.

  3. It generates a Dockerfile that:

    • Uses a Python slim base image
    • Copies and installs the requirements from requirements.txt
    • Copies the identified model files
    • Sets environment variables for detected model variables
    • Copies the rest of the project files
    • Configures additional installations (e.g., NLTK data)
    • Exposes the specified port
    • Sets the default command to run your specified entry point
  4. You can then use standard Docker commands to build and run your containerized ML project.

Requirements

  • Python 3.6+
  • Docker (for building and running the generated Docker image)

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

dockerizeasml-0.2.7.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

dockerizeasml-0.2.7-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file dockerizeasml-0.2.7.tar.gz.

File metadata

  • Download URL: dockerizeasml-0.2.7.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for dockerizeasml-0.2.7.tar.gz
Algorithm Hash digest
SHA256 69affdf64a08917a73e1fc80bad8ad59b19a4b72872f75e66f8b7244abba9e6d
MD5 c95345a5c89e20cd5a7da728b184482b
BLAKE2b-256 6e6560c1bf78c8ff9c22e49ee66a4992d28de6a47b25564b998a0e1b66148476

See more details on using hashes here.

File details

Details for the file dockerizeasml-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: dockerizeasml-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for dockerizeasml-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 5386528ca77293d577a3545c5996fcfba6871a36fd7af2dbaf557701daf03eb8
MD5 ea414b7b744057b4e2cf55b83df504db
BLAKE2b-256 6237c1f35f24a7e82de71ed17ed8d99e7856fa1fa7d8471ebef71b148d0a66bc

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