A minimalistic and high-performance Machine Learning library based on NumPy
Project description
🌌 Sorix
Sorix is a high-performance, minimalist deep learning library built on top of NumPy/CuPy. Designed for research and production environments where efficiency and a clean API matter. If you know PyTorch, you already know how to use Sorix.
🚀 Key Features
- ⚡ High Performance: Run optimized neural networks on NumPy (CPU) or CuPy (GPU).
- 🧩 PyTorch-like API: Familiar and expressive syntax for a near-zero learning curve.
- 🍃 Lightweight: Minimal dependencies, ideal for resource-constrained environments.
- 🛠️ Production Ready: Straight path from prototype to real-world deployment.
- 📈 Autograd Engine: Simple yet powerful automatic differentiation.
📊 Benchmark Results
Sorix outpaces the giants in resource efficiency while matching them in speed. In our MNIST benchmark, Sorix demonstrates its extreme lightweight nature:
| Library | CPU Size | GPU Size | Training (CPU) | Accuracy |
|---|---|---|---|---|
| Sorix | ~54 MB | ~238 MB | ~6.8s | 97.0% |
| PyTorch | ~737 MB | ~6.8 GB | ~5.1s | 97.4% |
| TensorFlow | ~1.4 GB | ~2.0 GB | ~17.8s | 97.1% |
💡 Tip: Sorix is ~28x smaller than PyTorch for GPU support and ~13x smaller on CPU, making it the perfect choice for serverless environments (like AWS Lambda) and edge computing.
📦 Installation
Choose your preferred package manager:
Using pip:
pip install sorix
Using uv:
uv add sorix
Using Poetry:
poetry add sorix
Note for GPU support: Install the CuPy extra using
pip install "sorix[cp13]"(Requires CuPy v13 and CUDA).
⚡ Full Pipeline: Define, Train, Save & Load
Building a neural network, training it, and persisting it for later use is straightforward:
import numpy as np
from sorix import tensor, save, load
from sorix.nn import Sequential, Linear, ReLU, MSELoss
from sorix.optim import SGD
# 1. Prepare data (y = 3x^2 + 2)
X = np.linspace(-1, 1, 100).reshape(-1, 1)
y = 3 * X**2 + 2 + 0.1 * np.random.randn(*X.shape)
X_t, y_t = tensor(X), tensor(y)
# 2. Define a multi-layer model
model = Sequential(
Linear(1, 10),
ReLU(),
Linear(10, 1)
)
# 3. Define loss and optimizer
criterion = MSELoss()
optimizer = SGD(model.parameters(), lr=0.01)
# 4. Training loop
for epoch in range(1000):
y_pred = model(X_t)
loss = criterion(y_pred, y_t)
optimizer.zero_grad()
loss.backward()
optimizer.step()
if (epoch + 1) % 200 == 0:
print(f"Epoch {epoch+1}, Loss: {loss.item():.4f}")
# 5. Save the model
save(model, "model.sor")
# 6. Load and verify
model_loaded = load("model.sor")
test_val = tensor([[0.5]])
print(f"Prediction for 0.5: {model_loaded(test_val).item():.4f}")
📖 Learn & Examples
Learn Sorix through interactive notebooks. Open them directly in Google Colab:
| Topic | Documentation | Colab |
|---|---|---|
| Tensor Basics | Tensors Guide | |
| Autograd Engine | Autograd Guide | |
| Module Basics | Module Guide | |
| Linear Regression | Regression Guide | |
| MNIST Classification | MNIST Guide |
🛠️ Roadmap
- Core Autograd Engine (NumPy/CuPy backends)
- Basic Layers: Linear, ReLU, Sigmoid, Tanh, BatchNorm1D, Dropout
- Optimizers: SGD, Adam, RMSprop
- GPU Acceleration via CuPy
- Sequential API
- Convolutional Layers (Conv2d, MaxPool2d)
- Advanced Initializations (Kaiming, Orthogonal)
- Data Loaders & Datasets
🤝 Contribution
We appreciate any contribution from the community!
- Report Bugs: Open an Issue.
- Add Features: Submit a Pull Request.
- Improve Docs: Help us make the documentation better.
- Write Tests: Improve our code coverage.
📌 Links
- Documentation: mitchell-mirano.github.io/sorix
- PyPI Package: sorix
- Samples: examples/ folder
Made with ❤️ for the AI Community
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sorix-1.0.6.tar.gz.
File metadata
- Download URL: sorix-1.0.6.tar.gz
- Upload date:
- Size: 2.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fb706828e28fcecec3e620f910c0698feb66bf0cb7f308c6f66073c5e5b4717
|
|
| MD5 |
b2e898c08274d82933f9aa62292868e6
|
|
| BLAKE2b-256 |
5cbb73db67964afbbe2880e4c91b5d99d22187c01954b8d3cf2ba7cf35ef827c
|
Provenance
The following attestation bundles were made for sorix-1.0.6.tar.gz:
Publisher:
pypi_publish.yml on Mitchell-Mirano/sorix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sorix-1.0.6.tar.gz -
Subject digest:
9fb706828e28fcecec3e620f910c0698feb66bf0cb7f308c6f66073c5e5b4717 - Sigstore transparency entry: 1110706261
- Sigstore integration time:
-
Permalink:
Mitchell-Mirano/sorix@db3034d23abeb8d5aab95877331decab0a9aeaee -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/Mitchell-Mirano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@db3034d23abeb8d5aab95877331decab0a9aeaee -
Trigger Event:
release
-
Statement type:
File details
Details for the file sorix-1.0.6-py3-none-any.whl.
File metadata
- Download URL: sorix-1.0.6-py3-none-any.whl
- Upload date:
- Size: 37.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e19781329986ac59dd4be59f7dbb2abb5f236987aa1a16949f8416ee37d5cc8
|
|
| MD5 |
0158f6f475c611ee80ecf8f79e509efa
|
|
| BLAKE2b-256 |
99bb2dd72b9124a6558f3f386d603c8bd9d052e3fb5528fe67870cd8d11bee9c
|
Provenance
The following attestation bundles were made for sorix-1.0.6-py3-none-any.whl:
Publisher:
pypi_publish.yml on Mitchell-Mirano/sorix
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sorix-1.0.6-py3-none-any.whl -
Subject digest:
7e19781329986ac59dd4be59f7dbb2abb5f236987aa1a16949f8416ee37d5cc8 - Sigstore transparency entry: 1110706281
- Sigstore integration time:
-
Permalink:
Mitchell-Mirano/sorix@db3034d23abeb8d5aab95877331decab0a9aeaee -
Branch / Tag:
refs/tags/v1.0.6 - Owner: https://github.com/Mitchell-Mirano
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi_publish.yml@db3034d23abeb8d5aab95877331decab0a9aeaee -
Trigger Event:
release
-
Statement type: