📚 Educational Tool for Exploring Language Model Internals
Welcome to the DistilGPT2 Visualization app! This interactive tool allows you to peek inside the "brain" of a language model and understand its inner workings.
- 🔍 Visualize various components of the DistilGPT2 model
- 💡 Explore embeddings, attention mechanisms, and more
- 📊 Interactive plots and heatmaps
- 🎓 Perfect for students, researchers, and AI enthusiasts
- 📝 Enter your query in the text box
- 🔢 Select a transformer block to visualize
- 🖱️ Click "Submit" to generate visualizations
- 📌 Embeddings: See how words are represented numerically
- 🔁 Residual Streams: Observe information flow through the model
- 📏 LayerNorm1 & LayerNorm2: Understand normalization techniques
- 👀 Attention: Visualize how the model focuses on different parts of the input
- 🧮 MLP: Explore the feed-forward neural network components
- 🧠 Demystify the inner workings of transformer-based language models
- 🔬 Provide hands-on experience with model internals
- 📈 Enhance understanding of NLP concepts through visual representations
- Built with Python, Gradio, and PyTorch
- Utilizes the
transformer_lens
library for model introspection - Generates interactive plots using Plotly
To run this project on your local machine, follow these steps:
-
📥 Clone the repository:
git clone https://github.com/Mahdi-s/llm.guts.git cd llm.guts
-
🐍 Create a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
📦 Install the required dependencies:
pip install -r requirements.txt
-
🚀 Run the application:
python app.py
-
🌐 Open your web browser and navigate to
http://localhost:7860
to access the application.
Note: Ensure you have Python 3.11+ installed on your system before running the application locally.
Alternatively, you can run the application using Docker:
-
🏗️ Build the Docker image:
docker build -t llm.guts .
-
🐳 Run the Docker container:
docker run -p 7860:7860 llm.guts
-
🌐 Access the application at
http://localhost:7860
in your web browser.
Dive in and start exploring the fascinating world of language models!
I'm working on adding support for additional models, let me know which models you'd like to see here. :)