Welcome to SilvaXNet, the next evolution of SilvaNet! Now, with built-in GPU acceleration via CuPy, SilvaXNet provides a seamless deep learning experience for both CPU and GPU users. Whether you're an AI enthusiast, researcher, or educator, this library offers a lightweight, intuitive, and educational deep learning framework that runs efficiently on both CPU (NumPy) and GPU (CuPy).
At this moment, we have SilvaNet (CPU version), with the intent to extend to SilvaXNet (GPU version).
- Retains pure NumPy implementation for maximum portability
- Ideal for environments without GPU support
- Planned CuPy integration for GPU acceleration
- Seamless NumPy ↔ CuPy tensor operations
- Optimized matrix operations for speedup
- Effortless switching between SilvaNet (NumPy) and SilvaXNet (CuPy)
- API remains consistent for both backends
- Convolutional Layers (CNNs) optimized for GPU
- Better gradient computation with autograd
- Enhanced support for ANNs, RNNs, LSTMs, GRUs, and more!
- Autograd Support: Automatic differentiation for smooth backpropagation.
- Deep Learning Layers:
- Fully Connected (Dense) Layers
- Recurrent Layers: RNN, LSTM, GRU
- Convolutional Layers (Currently CPU-based)
- Loss Functions: Cross-Entropy, MSE, and more.
- Optimized Computation: NumPy-based operations for efficiency.
- Model Management: Save and load trained models seamlessly.
Here's a quick example using SilvaNet (CPU-only):
import numpy as np # For CPU (SilvaNet)
from nn.Layers import Sequential, Dense
from nn.losses import CrossEntropyLoss
from nn.optimizer import SGD
from Network import NeuralNetwork
# Sample data
X_train = np.random.rand(100, 10)
y_train = np.random.randint(0, 2, size=(100, 1))
# Define the neural network
model = Sequential()
model.add(Dense(n_inputs=10, n_units=64, activation='relu'))
model.add(Dense(n_inputs=64, n_units=32, activation='relu'))
model.add(Dense(n_inputs=32, n_units=2))
# Loss function and optimizer
loss_fn = CrossEntropyLoss()
optimizer = SGD(parameters=model.get_parameters(), alpha=0.01)
# Train
nn = NeuralNetwork(model, loss_fn, optimizer)
nn.fit(X_train, y_train, epochs=100, batch_size=16)
To install SilvaNet, clone the repository:
git clone https://github.com/silvaxxx1/SilvaXNet
cd SilvaXNet
For SilvaNet (CPU):
pip install -r requirements_cpu.txt # NumPy-based
GPU support (SilvaXNet) is currently in development.
Check out the full API reference, guides, and tutorials here: Documentation
We welcome contributions from the community! If you want to improve SilvaNet or help develop SilvaXNet, check out our contributing guidelines. We’d love to hear your feedback!
SilvaNet is licensed under the MIT License. See the LICENSE file for more details.