Skip to content

Neural Network Programming Language This project introduces a new programming language designed specifically for defining neural network models.

License

Notifications You must be signed in to change notification settings

Lemniscate-SHA-256/Neural

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design sans titre (1) (1)

Neural: A Neural Network Programming Language

License: MIT Python 3.8+ Discord

Neural is a domain-specific language (DSL) designed for defining, training, and deploying neural networks. With declarative syntax and cross-framework support, it simplifies building complex architectures while automating error-prone tasks like shape validation.

Network Visualization Demo
Example: Auto-generated architecture diagram and shape propagation report

🚀 Features

  • YAML-like Syntax: Define models intuitively without framework boilerplate.
  • Shape Propagation: Catch dimension mismatches before runtime.
  • Multi-Backend Export: Generate code for TensorFlow, PyTorch, or ONNX.
  • Training Orchestration: Configure optimizers, schedulers, and metrics in one place.
  • Visual Debugging: Render interactive 3D architecture diagrams.
  • Extensible: Add custom layers/losses via Python plugins.

📦 Installation

# Clone the repository
git clone https://github.com/yourusername/neural.git
cd neural

# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # Linux/macOS
venv\Scripts\activate     # Windows

# Install dependencies
pip install -r requirements.txt

Prerequisites: Python 3.8+, pip

🛠️ Quick Start

1. Define a Model

Create mnist.neural:

network MNISTClassifier {
  input: (28, 28, 1)  # Channels-last format
  layers:
    Conv2D(filters=32, kernel_size=(3,3), activation="relu")
    MaxPooling2D(pool_size=(2,2))
    Flatten()
    Dense(units=128, activation="relu")
    Dropout(rate=0.5)
    Output(units=10, activation="softmax")
  
  loss: "sparse_categorical_crossentropy"
  optimizer: Adam(learning_rate=0.001)
  metrics: ["accuracy"]
  
  train {
    epochs: 15
    batch_size: 64
    validation_split: 0.2
  }
}

2. Generate Framework Code

# For TensorFlow
python neural.py compile mnist.neural --backend tensorflow --output mnist_tf.py

# For PyTorch
python neural.py compile mnist.neural --backend pytorch --output mnist_torch.py

3. Visualize Architecture

python neural.py visualize mnist.neural --format png

MNIST Architecture

🌟 Why Neural?

Feature Neural Raw TensorFlow/PyTorch
Shape Validation ✅ Auto ❌ Manual
Framework Switching 1-line flag Days of rewriting
Architecture Diagrams Built-in Third-party tools
Training Config Unified Fragmented configs

📚 Documentation

Explore advanced features:

🤝 Contributing

We welcome contributions! See our:

To set up a development environment:

git clone https://github.com/yourusername/neural.git
cd neural
pip install -r requirements-dev.txt  # Includes linter, formatter, etc.
pre-commit install  # Auto-format code on commit

📬 Community

About

Neural Network Programming Language This project introduces a new programming language designed specifically for defining neural network models.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published