Package: yerbamate
Maté 🧉your modular AI project and experiment managerWelcome toMaté! 🎉👋🏼Maté is an open science modular Python framework designed to streamline and simplify the development and management of machine learning projects. It was developed to address the reproducibility crisis in artificial intelligence research by promoting open science and accessible AI. 🌍💻The framework is built around the best software engineering practices of modularity and separation of concerns, encouraging quality coding, collaboration, and the sharing of models, trainers, data loaders, and knowledge. The modular design and separation of concerns simplify the development and maintenance of machine learning models, leading to an improved developer experience. 🚀💻👨‍💻💬🧠With Maté, you can easily install the source code of open-source projects and adhere to modularity and separation of concerns, making your models and modules sharable out of the box. This means you can collaborate more effectively with others and easily share your work. 📦💻🤝Thank you for choosing Maté, and we can't wait to see the amazing machine learning projects you'll create with it! 🎉👨‍💻🌟Features 🎉Seamless integration with any python library such as PyTorch/Lightning, TensorFlow/Keras, JAX/Flax, Huggingface/transformers. 🤝🤗🐉Easy to use interface to add source code of models, trainers, and data loaders to your projects. 🎨💻📝Support for full customizability and reproducibility of results through the inclusion of dependencies in your project. 🌟🔍🧪Modular project structure that enforces a clean and organized codebase. 🧱👨‍💻👌Fully compatible with python. No need to use mate commands to run your experiments. 🐍💻🚀Convenient environment management through the Maté Environment API. 🌍👨‍💻🔧Support for pip and conda for dependency management. 📦🔍💻Works withColabout of the box.  🎉👌🤖Table of ContentsInstallationQuick StartProject StructureExample ProjectsDocumentationContributionGuidesOpen ScienceInstallation 🔌pipinstallyerbamateQuick Start ⚡Initialize a projectmateinitdeepnetThis will generate the following empty project structure:/|--models/||--__init__.py|--experiments/||--__init__.py|--trainers/||--__init__.py|--data/||--__init__.pyInstall an experimentTo install an experiment, you can usemate installto install a module and its
dependencies from a github repository. Seedocsfor more details.# Short version of GitHub URL https://github.com/oalee/big_transfer/tree/master/big_transfer/experiments/bitmateinstalloalee/big_transfer/experiments/bit-yopip# Short version of GitHub URL https://github.com/oalee/deep-vision/tree/main/deepnet/experiments/resnetmateinstalloalee/deep-vision/deepnet/experiments/resnet-yopipInstall a moduleYou can install independant modules such as models, trainers, and data loaders
from github projects that follow theIndependent modular project structure.mateinstalloalee/lightweight-gan/lgan/trainers/lganmateinstalloalee/big_transfer/models/bit-yopip
mateinstalloalee/deep-vision/deepnet/models/vit_pytorch-yopip
mateinstalloalee/deep-vision/deepnet/trainers/classification-yopipSetting up environmentSet up your environment before running your experiments. This can be done by using shell, orenv.jsonfile in the root of your project. Maté API requiresresultsto be set in the environment. For more information, seedocs.DATA_PATH=/path/to/dataresults=/path/to/results{"DATA_PATH":"/path/to/data","results":"/path/to/results"}Train a modelTo train a model, you can use themate traincommand. This command will train
the model with the specified experiment. For example, to train the an experiment
calledlearnin thebitmodule, you can use the following command:matetrainbitlearn# or alternatively use pythonpython-mdeepnet.experiments.bit.learntrainProject Structure 📁Deep learning projects can be organized into the following structure with
modularity and seperation of concerns in mind. This offers a clean and organized
codebase that is easy to maintain and is sharable out-of-the-box.
The modular structure of the framework involves organizing the project directory in a hierarchical tree structure, with an arbitrary name given to the root project directory by the user. The project is then broken down into distinct concerns such as models, data, trainers, experiments, analyzers, and simulators, each with its own subdirectory. Within each concern, modules can be defined with their own subdirectories, such as specific models, trainers, data loaders, data augmentations, or loss functions.└──project_name├──data│├──my_independent_data_loader│└──__init__.py├──experiments│├──my_awesome_experiment│└──__init__.py├──__init__.py├──models│├──awesomenet│└──__init__.py└──trainers├──big_brain_trainer└──__init__.pyModularityModularity is a software design principle that focuses on creating
self-contained, reusable and interchangeable components. In the context of a
deep learning project, modularity means creating three independent standalone
modules for models, trainers and data. This allows for a more organized,
maintainable and sharable project structure. The forth module, experiments, is
not independent, but rather combines the three modules together to create a
complete experiment.Independent ModulesYerbamate prioritizes the organization of the project into independent modules when applicable. Independent modules only depend on Python dependencies (such as NumPy, PyTorch, TensorFlow, or Hugging Face), and the code inside the module uses relative imports to import within the module. This makes it an independent module that can be re-used when Python dependencies are installed.Non-Independent ModulesIn some cases, a combination of independent modules may be necessary for a particular concern. An example of this is the experiment concern, which imports and combines models, data, and trainers to define and create a specific experiment. In such cases, the module is not independent and is designed to combine the previously defined independent modules. In the case of non-independent modules, Yerbamate creates a dependency list of independent modules that can be used to install the code and Python dependencies. This ensures that the necessary modules are installed, and that the code can be run without issue.Sample Modular Project StructureThis structure highlights modularity and seperation of concerns. Themodels,dataandtrainersmodules are independent and can be used in any project.
Theexperimentsmodule is not independent, but rather combines the three
modules together to create a complete experiment..
├──mate.json
└──deepnet├──data│├──bit││├──fewshot.py││├──__init__.py││├──minibatch_fewshot.py││├──requirements.txt││└──transforms.py│└──__init__.py├──experiments│├──bit││├──aug.py││├──dependencies.json││├──__init__.py││├──learn.py││└──requirements.txt│└──__init__.py├──__init__.py├──models│├──bit_torch││├──downloader│││├──downloader.py│││├──__init__.py│││├──requirements.txt│││└──utils.py││├──__init__.py││├──models.py││└──requirements.txt│└──__init__.py└──trainers├──bit_torch│├──__init__.py│├──lbtoolbox.py│├──logger.py│├──lr_schduler.py│├──requirements.txt│└──trainer.py└──__init__.pyExample Projects 📚Please check out thetransfer learning,vision models, andlightweight gan.Documentation 📚Please check out thedocumentation.Guides 📖For more information on modularity, please check out thisguide.For running experiments on Google Colab, please check out thisexampleContribution 🤝We welcome contributions from the community! Please check out ourcontributingguide for more information on how to get started.Contact 🤝For questions please contact:oalee(at)proton.meOpen Science 📖As an open science work, Yerbamate strives to promote the principles of transparency and collaboration. To this end, the history of the LaTeX files for work are available onGitHub. These open science repositories are open to collaboration and encourage participation from the community to enhance the validity, reproducibility, accessibility, and quality of this work.