Skip to content
/ minima Public

a lightweight deep learning framework, lean yet effective tailor-made for educational exploration.

License

Notifications You must be signed in to change notification settings

m0saan/minima

Repository files navigation

Welcome to minima

CI PyPI Conda (channel only) docs

minima: A Mini Deep Learning Framework

minima is a lightweight deep learning framewor, lean yet effective tailor-made for educational exploration.
Just like a delicate sapling inspired by the towering strength of an oak, Minima draws its inspiration from PyTorch.
Yet, it carves its own identity with a straightforward interface and a curated set of features.
This makes learning and using it a breeze, allowing you to effortlessly build and train neural networks.
Indeed, Minima is your friendly companion on the journey to understanding deep learning, where less is often more.

Installing

You can install minima on your own machines with conda

If you’re using miniconda (recommended) then run:

conda install minima

…or if you’re using Anaconda then run:

conda install minima anaconda

To install with pip, use: pip install minima.

If you plan to develop Minima yourself, or want to be on the cutting edge, you can use an editable install.

git clone https://github.com/m0saan/minima
pip install .

Features

  • Easy to install and use
  • Simple and intuitive API for defining and training neural networks
  • Built-in support for common layers and activation functions
  • Supports both CPU and GPU acceleration
  • Compatible with NumPy arrays for easy data manipulation

Usage

Here’s a simple example of how to define and train a neural network using Minima:

import minima as mi

# Define the neural network architecture
model = mi.nn.Sequential(
    mi.nn.Linear(784, 128),
    mi.nn.ReLU(),
    mi.nn.Linear(128, 10),
    mi.nn.Softmax()
)

# Load the dataset
x_train, y_train, x_test, y_test = load_data()

# Train the model
loss_fn = mi.nn.CrossEntropyLoss()
optimizer = mi.optim.SGD(model.parameters(), lr=0.01)
for epoch in range(10):
    for x_batch, y_batch in mi.nn.minibatch(x_train, y_train, batch_size=32):
        y_pred = model(x_batch)
        loss = loss_fn(y_pred, y_batch)
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

# Evaluate the model
y_pred = model(x_test)
accuracy = compute_accuracy(y_pred, y_test)
print(f"Accuracy: {accuracy:.2f}")

This example defines a simple neural network with two linear layers and two activation functions, trains it on a dataset using stochastic gradient descent, and evaluates its accuracy on a test set.

Documentation

For more information on how to use minima, please refer to the documentation, which can be found in the website above.

Contributing

coming soon!

License

minima is released under the Apache License 2.0. See LICENSE for more information.