https://github.com/willayy/modularml
Lightweight, transparent and modular ML Framework
https://github.com/willayy/modularml
machine-learning
Last synced: 11 months ago
JSON representation
Lightweight, transparent and modular ML Framework
- Host: GitHub
- URL: https://github.com/willayy/modularml
- Owner: willayy
- Created: 2025-01-20T15:31:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-17T18:12:52.000Z (over 1 year ago)
- Last Synced: 2025-03-17T18:35:08.251Z (over 1 year ago)
- Topics: machine-learning
- Language: C++
- Homepage: https://willayy.github.io/modularml/
- Size: 969 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
Awesome Lists containing this project
README
# ModularML

[](https://opensource.org/licenses/MIT)


ModularML is a machine learning framework with the aim to let users more easily load, explore and experiment with ML models as to foster a greater understanding behind the underlying processes that make machine learning possible.
The framework loads already trained models using the onnx format, the onnx file is then translated into JSON which the framework uses during runtime to construct the model internally. The user is then to run inference on the model by feeding the model some input data.
### Backend Implementations
Machine learning entails heavy use of **General Matrix Multiplication (GEMM)** to perform calculations. ModularML provides several interchangeable backend implementations for executing these efficiently.
Current backend implementations include:
- **Naive GEMM Backend**
A simple reference implementation. Good for understanding the computation step-by-step.
- **Blocked GEMM Backend**
Optimized for cache locality by processing matrices in smaller blocks.
- **AVX2 GEMM Backend**
Uses AVX2 SIMD intrinsics to faster computation on supported CPU:s.
- **AVX512 GEMM Backend**
Uses AVX512 SIMD intrinsics to even faster computation on supported CPU:s.
- **CUDA GEMM Backend**
Uses CUDA for computation on supported GPU:s
### Requirements
- **C++ Compiler**
- g++ `GCC >= 12`
- Clang `>= 10`
- **Build Tools**
- Make
- CMake `>= 3.30`
### Install Dependencies
This command installs the neccessary dependencies needed to build the framework.
```sh
make install
```
### Configure & Build The Framework
These commands will configure and build the framework using the default naive GEMM backend.
```sh
cd build
cmake ..
make -j[Number of cores]
```
To build the framework using the blocked GEMM backend for example:
```sh
cd build
cmake -DBUILD==blocked ..
make -j[Number of cores]
```
To check which backends are available on your system:
```sh
make check_backends
```
This will show you a list of available and/or unavailable backends.
### Run Tests
These commands will run all the unit and integration tests for the framework using the default naive GEMM backend.
```sh
cd build
ctest
```
### Install using CMake Fetchcontent
A library version of ModularML where you can change operation implementations dynamically can be installed by putting
```cmake
# ----------------------- MODULARML -------------------------- #
include(FetchContent)
FetchContent_Declare(
modularml
GIT_REPOSITORY https://github.com/willayy/modularml-lib
GIT_TAG
)
FetchContent_MakeAvailable(modularml)
target_link_libraries(MyProject PRIVATE modularml)
# ------------------------------------------------------------ #
```
In your CMakeLists.txt file, for information about its specific usage check https://github.com/willayy/modularml-lib
### Contributing
We welcome contributions!
Please read our [Contributing Guide](CONTRIBUTING.md) for instructions on how to get started.
### License
This project is licensed under the [MIT License](LICENSE).
### Acknowledgments
This framework was developed as part of a Bachelor Thesis at Chalmers University of Technology.