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
-
DockerizeAsML scans your project directory for ML model files.
-
It analyzes Python scripts to detect potential model variable names.
-
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
-
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)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Thanks to all contributors who have helped shape DockerizeAsML.
- Inspired by the need for simplified ML project containerization in the data science community.
Contact
If you have any questions or issues, please open an issue on the GitHub repository.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dockerizeasml-0.2.5.tar.gz.
File metadata
- Download URL: dockerizeasml-0.2.5.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5635a603bd46481b139e81825c49c078df335bb1c64a71acce74f75c810983e
|
|
| MD5 |
946b841888aeb5f75cd1407b9ef9edf5
|
|
| BLAKE2b-256 |
df5661e0e928c26098fa183ff9082a0e8d6662f4eb07cfbab056a4e1e8c27839
|
File details
Details for the file dockerizeasml-0.2.5-py3-none-any.whl.
File metadata
- Download URL: dockerizeasml-0.2.5-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eca93109384e28c6f4d519be1d568ce3b9ad128348841efd5c8a15a9b6ea8fe2
|
|
| MD5 |
4df8dbb71b3f07e87a9ef6a42756d071
|
|
| BLAKE2b-256 |
ef9b23ad5e0637982018e481f8bd3de1b8b5634033978ce6794274951f743e25
|