Skip to main content

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.

Python Tests License


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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuroforge_dl-0.2.0.tar.gz (45.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuroforge_dl-0.2.0-py3-none-any.whl (61.3 kB view details)

Uploaded Python 3

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

Hashes for neuroforge_dl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e8293093a38c9192e40bcdb43b6d6d4eb9d4be5c97022a5dd49384ff6a896c2b
MD5 55d2a8330a0dec86beb2c3b91f6afe04
BLAKE2b-256 686894cd954f50750d6f1aa739019622be83330ab872c1b284c4d63798e088ec

See more details on using hashes here.

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

Hashes for neuroforge_dl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fa1f38d080879c10344477e69a2d2141d570c060522fca63436ac2b019b376e
MD5 1c0baae10a7a7db666961c59c7715f98
BLAKE2b-256 2269e5aab9042fddd2cbbe950df4c3f081ff7267db08f2b2b47bcdcf24ec0788

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page