MLOps-ML Project Code Template

Sarang Mete
2 min readOct 19, 2022

--

Code template for production ready code — Repo

Developer has to look beyond just model building. The main challenges are faced in creating complete ecosystem to fit ML model into.

I’ve created code template for Machine Learning application development lifecycle. This code template includes folder structure as well as some boilerplate code used for typical ML project to be developed and pushed to production.

This code template can be used for end to end ML project development as well as deployment.

The code template considers following phases in ML project development lifecycle:
Requirement gathering
Data Collection
Model Building
Inference
Testing
Deployment

There are a lot of commercial as well as open source libraries available to achieve this but this project is created to start on your own with simple base code.

During typical ML project lifecycle,this code template can be used in following way:

  1. Keep all Requirement gathering documents in docs folder.
  2. Keep Data Collection and exploration notebooks in src/training folder.
  3. Keep datasets in data folder.
  4. Keep model building notebooks at src/training folder.
  5. Keep generated model files at src/models.
  6. Write and keep inference code in src/inference.
  7. Write Logging and configuration code in src/utility.
  8. Write unit test cases in tests folder.pytest,pytest-cov
  9. Write performance test cases in tests folder.locust
  10. Build docker image.Docker
  11. Use and configure code formatter.black
  12. Use and configure code linter.pylint
  13. Add Git Pre-commit hooks.
  14. Use Circle Ci for CI/CD.Circlci

Clone this repo locally and add/update/delete as per your requirement.
Please note that this template is in no way complete or the best way for your project structure.

This template is just to get you started quickly with almost all basic phases covered.

If you liked the article or have any suggestions/comments, please share them below!

Let’s connect and discuss on LinkedIn

--

--