That repository was created to pratice my notes from my studies based on the video MIT Introduction to Deep Learning | 6.S191
This project simulates how a neuron works in deep learning using Python. It provides a step-by-step implementation of fundamental neural network concepts, from basic mathematical operations to a simple PyTorch-based Large Language Model (LLM).
| Step | Concept | File Name |
|---|---|---|
| 1️⃣ | Neuron (Perceptron) Calculation | 01_neuron.py |
| 2️⃣ | Activation Functions (Sigmoid, ReLU, Tanh) | 02_activation_functions.py |
| 3️⃣ | Building a Simple Neural Network (Forward Pass) | 03_neural_network.py |
| 4️⃣ | Loss Function & Backpropagation | 04_backpropagation.py |
| 5️⃣ | Training the Neural Network (Gradient Descent) | 05_training.py |
| 6️⃣ | Making Predictions on New Data | 06_prediction.py |
Ensure you have the required Python libraries installed:
pip install numpy matplotlib torch torchvision torchaudio transformers datasets fastapi uvicornConcept: Implements a basic artificial neuron with an activation function.
What it does:
- Defines a simple neuron equation:
output = activation_function(weight * input + bias). - Uses Sigmoid and ReLU as activation functions.
- Plots the activation function curve using
matplotlib.
Usage:
python 01_neuron_activation.pyConcept: Implements a single-layer perceptron, the fundamental unit of neural networks.
What it does:
- Uses NumPy to perform matrix operations.
- Implements a simple perceptron that learns to classify AND / OR / XOR logic gates.
- Trains the perceptron using gradient descent.
Usage:
python 02_perceptron.pyConcept: Expands on the perceptron to create a multi-layer perceptron (MLP).
What it does:
- Defines a feedforward neural network with multiple layers.
- Uses backpropagation to update weights.
- Simulates training on a simple dataset.
Usage:
python 03_multilayer_perceptron.pyConcept: Trains an MLP model on real data.
What it does:
- Uses PyTorch to create a small neural network.
- Loads a sample dataset.
- Implements a training loop to optimize model performance.
- Saves the trained model.
Usage:
python 04_neural_network_training.pyConcept: Helps users understand how training progresses over time.
What it does:
- Plots the loss function over multiple epochs.
- Visualizes how weights change during training.
- Uses
matplotlibfor real-time visualization.
Usage:
python 05_visualize_training.pyConcept: Demonstrates how to use a trained neural network.
What it does:
- Loads a pre-trained neural network.
- Uses the model to make predictions on new input data.
- Prints and visualizes the output.
Usage:
python 06_neural_network_inference.pyOnce you understand these fundamental concepts, you can move to:
- [ ]-
07_simple_llm.py– Creating a transformer-based LLM. - [ ]-
08_train_llm.py– Training an LLM with real text data. - [ ]-
09_use_llm.py– Using the LLM for text generation. - [ ]-
10_deploy_llm.py– Deploying the model as a FastAPI API.