An example GitHub-hosted repository for a Machine Learning (ML) model using best practices for model deployment. This repository can be used as a template for hosting a ML model on GitHub for publishing to other "hubs" and to easily share a model with anyone.
-
Ensure Python >= v3.7.0 is installed on the computer.
-
Start a terminal. This can be Windows Terminal, Terminal.app, Gnome Terminal, or similar application running a shell, like bash, zsh, PowerShell, etc.
-
Clone this repository.
git clone https://github.com/Theia-Scientific/model-template.git
-
Navigate into the project's root folder, i.e. the same folder as this README file.
cd model-template -
Create a virtual environment to safely install the Python dependencies. This step only has to be done once. If a virtual environment already exists, then this step can be skipped.
python3 -m venv .venv
The
python3command is used to ensure that the correct version of Python is used. Some system will have Python v2 and v3 installed and thepythoncommand will use Python v2. -
Activate the virtual environment.
source .venv/bin/activateThe prompt in your terminal may change appearance to indicate you are in the virtual environment and are safe to install dependencies without clobbering the dependencies for other models installed on your computer.
-
Install the Python dependencies, i.e. requirements, into the virtual environment created in the previous step.
python3 -m pip install -r requirements.txt
-
Run the inference.
python3 detect.py --weights ./weights/cat-detector_v1.0.0.pt ./images/cats.jpg
Please use the following BibTeX citation for including in bibliographies and references:
@software{theia_scientific_model_template,
author = {Christopher Field and
Kevin Field and
title = {{Theia-Scientific/model-template - A template repository
for sharing Machine Learning models for the Nuclear Materials
community}},
month = aug,
year = 2022,
publisher = {zenodo},
version = {v1.0.0},
doi = {10.5281/zenodo.6977690},
url = {https://doi.org/10.5281/zenodo.6977690}
}This material is based upon work supported by the U.S. Department of Energy, Office of Science, Office of Basic Energy Sciences under Award Number DE-SC0021529.
The model-template project is licensed under Apache-2.0 license. See the LICENSE file for information.