Welcome to minima
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
= mi.nn.Sequential(
model 784, 128),
mi.nn.Linear(
mi.nn.ReLU(),128, 10),
mi.nn.Linear(
mi.nn.Softmax()
)
# Load the dataset
= load_data()
x_train, y_train, x_test, y_test
# Train the model
= mi.nn.CrossEntropyLoss()
loss_fn = mi.optim.SGD(model.parameters(), lr=0.01)
optimizer for epoch in range(10):
for x_batch, y_batch in mi.nn.minibatch(x_train, y_train, batch_size=32):
= model(x_batch)
y_pred = loss_fn(y_pred, y_batch)
loss
optimizer.zero_grad()
loss.backward()
optimizer.step()
# Evaluate the model
= model(x_test)
y_pred = compute_accuracy(y_pred, y_test)
accuracy 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.