A full-featured deep learning framework and production AI platform built from first principles in Python & NumPy.
Project description
NeuroForge ๐ง โก
A full-featured deep learning framework and production AI platform โ built entirely from first principles in Python/NumPy.
What is NeuroForge?
NeuroForge is a complete, production-ready deep learning stack implemented from scratch โ no PyTorch, no TensorFlow, no Keras. Every component, from the tensor engine to the FastAPI model-serving layer, is hand-crafted:
| Layer | What's included |
|---|---|
| ๐ข Tensor Engine | NumPy-backed N-D arrays, dynamic autograd computation graph, full reverse-mode AD |
| ๐งฑ Neural Modules | Linear, Conv1D, Conv2D, ConvTranspose2D, MaxPool, AvgPool, RNN, LSTM, GRU, Attention, Transformer, Embedding, LayerNorm, BatchNorm, Dropout |
| ๐๏ธ Model Zoo | MLP, ConvNet, ResNet (ResNet18/34), U-Net, BERT, VAE, GPT, VisionTransformer, VisionLanguageModel |
| ๐ Losses | CrossEntropy, BCE, BCEWithLogits, MSE, VAE Loss (BCE + KL) |
| โ๏ธ Optimizers & Schedulers | SGD (+ momentum), Adam, AdamW, StepLR, CosineAnnealingLR, WarmupCosineScheduler, WarmupLinearScheduler, ExponentialLR |
| ๐ ๏ธ Training & Utilities | Trainer, Gradient Clipping (norm & value), Numerical Gradient Checker, Weight Initialization (Xavier, Kaiming, Orthogonal), Callbacks |
| ๐ Experiments & Visuals | ExperimentTracker, Plot Training History, Gradient Norm Inspection |
| ๐ฆ Registry & Serving | ModelRegistry (versioned save/load) + FastAPI REST server (/health, /models, /predict, /generate, /metrics) |
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ NeuroForge Stack โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ neuroforge.core โ Tensor + Autograd Engine โ
โ neuroforge.nn โ Module, Parameter, 16 Layer Types โ
โ neuroforge.models โ MLP, ConvNet, ResNet, UNet, BERT, VAE... โ
โ neuroforge.losses โ CrossEntropy, BCE, MSE, VAE Loss โ
โ neuroforge.optim โ SGD, Adam, AdamW, Warmup Schedulers โ
โ neuroforge.data โ TensorDataset, DataLoader โ
โ neuroforge.training โ Trainer, Callbacks, Metrics โ
โ neuroforge.utils โ Init, Grad Clipping, Grad Check, Plots โ
โ neuroforge.experimentsโ ExperimentTracker โ
โ neuroforge.registry โ ModelRegistry (versioned persistence) โ
โ neuroforge.inference โ InferenceEngine โ
โ neuroforge.serving โ FastAPI production REST server โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Quick Start
Installation
cd NeuroForge
pip install -e .
Train a ConvNet in 5 lines
import numpy as np
from neuroforge import ConvNet, CrossEntropyLoss, Adam, TensorDataset, DataLoader, Trainer
X = np.random.randn(200, 1, 28, 28).astype("float32")
y = np.random.randint(0, 10, size=(200,)).astype("int64")
model = ConvNet(in_channels=1, num_classes=10, channels=[16, 32])
trainer = Trainer(model, CrossEntropyLoss(), Adam(model.parameters(), lr=0.005))
history = trainer.fit(DataLoader(TensorDataset(X, y), batch_size=32), epochs=5)
Advanced Models: ResNet18, U-Net, BERT & VAE
import neuroforge as nf
# ResNet-18
resnet = nf.ResNet18(in_channels=3, num_classes=10)
nf.apply_init(resnet, init_fn=nf.kaiming_normal_)
# U-Net Image Segmentation
unet = nf.UNet(in_channels=1, out_channels=1, features=[32, 64])
# BERT Masked Language Model
bert = nf.BERT(vocab_size=1000, d_model=128, nhead=4, num_layers=4)
# VAE with Reparameterization
vae = nf.VAE(input_dim=784, hidden_dim=256, latent_dim=32)
Examples
python examples/01_mnist_cnn.py # ConvNet image classification
python examples/02_text_gpt.py # GPT language model + text generation
python examples/03_multimodal_demo.py # Vision-Language multimodal model
python examples/04_advanced_models_demo.py # ResNet, U-Net, BERT, VAE, Grad Clipping & Warmup
CLI Training & Serving
# CLI Training
python scripts/train.py --config configs/default_train.yaml
# REST Serving
python scripts/serve.py --host 0.0.0.0 --port 8000
Testing
python -m pytest tests/ -v
36 passed in 1.45s โ
| Test Suite | Tests | Status |
|---|---|---|
tests/unit/test_tensor.py |
5 | โ |
tests/unit/test_autograd.py |
3 | โ |
tests/unit/test_layers.py |
5 | โ |
tests/unit/test_advanced_layers.py |
2 | โ |
tests/unit/test_models.py |
5 | โ |
tests/unit/test_advanced_models.py |
4 | โ |
tests/unit/test_optimizers.py |
3 | โ |
tests/unit/test_utils_and_schedulers.py |
4 | โ |
tests/unit/test_serving.py |
4 | โ |
tests/integration/test_pipeline.py |
1 | โ |
License
MIT License. See LICENSE.
Project details
Release history Release notifications | RSS feed
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 neuroforge_dl-0.2.0.tar.gz.
File metadata
- Download URL: neuroforge_dl-0.2.0.tar.gz
- Upload date:
- Size: 45.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8293093a38c9192e40bcdb43b6d6d4eb9d4be5c97022a5dd49384ff6a896c2b
|
|
| MD5 |
55d2a8330a0dec86beb2c3b91f6afe04
|
|
| BLAKE2b-256 |
686894cd954f50750d6f1aa739019622be83330ab872c1b284c4d63798e088ec
|
File details
Details for the file neuroforge_dl-0.2.0-py3-none-any.whl.
File metadata
- Download URL: neuroforge_dl-0.2.0-py3-none-any.whl
- Upload date:
- Size: 61.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fa1f38d080879c10344477e69a2d2141d570c060522fca63436ac2b019b376e
|
|
| MD5 |
1c0baae10a7a7db666961c59c7715f98
|
|
| BLAKE2b-256 |
2269e5aab9042fddd2cbbe950df4c3f081ff7267db08f2b2b47bcdcf24ec0788
|