Repository navigation
Developer Guide Adding a New Model
TokenPrint currently defaults to Qwen2.5. This guide explains how to add explicit support for a new model architecture (e.g., DeepSeek) to the platform.
Because TokenPrint is architecture-aware, simply changing the MODEL_NAME string in the backend might result in incorrect visuals if the frontend doesn't know how to render the new model's specific quirks (like new normalization layers or attention variants).
Ensure the ModelEngine can load the model via transformers.
Crucially, verify that attn_implementation="eager" actually returns the attention tensors. Some custom model implementations on HuggingFace require patches to expose intermediate variables.
In the frontend, locate detectArch() in lib/formulas.ts.
Add a condition to check for the new architecture string (e.g., config.architecture === 'deepseek').
Define the LaTeX formula set for this architecture.
If the model uses a standard block (like Llama), no changes are needed.
If the model uses a novel block (like Phi-2's parallel structure), you must create a new branch in TransformerStack.tsx that alters the 3D layout when that architecture is detected.
Download a quantized version of the model. Drag it into the frontend and verify the client-side parser in lib/gguf/ correctly reads the header and maps the tensors.
flowchart LR
HF[HuggingFace Model] --> Backend[Verify Eager Attention]
Backend --> Formulas[Update detectArch in formulas.ts]
Formulas --> Geo[Update TransformerStack.tsx]
Geo --> GGUF[Test Client Parser Compatibility]
| Previous | Home | Next |
|---|---|---|
| Adding a New Visualization | Home | Creating UI Components |
TokenPrint Wiki | Home | Getting Started | User Guide | Concepts | Architecture | API | GitHub
TokenPrint is an interactive 3D visualization platform for exploring transformer architectures, tensors, and real-time LLM inference.
- User Guide
- Architecture Explorer
- Live Inference
- Tensor Inspector
- Camera Controls
- HUD
- Timeline
- Scene Navigation
- Transformer Concepts
- Tokenization
- Embeddings
- Positional Encoding
- RoPE
- Multi-Head Attention
- KV Cache
- LayerNorm
- Feed Forward Network
- Residual Connections
- Logits
- Softmax
- Sampling
- Autoregressive Generation
- Visualization System
- Scene Graph
- Geometry
- Materials
- Animation System
- Color Mapping
- Camera System
- Interaction Model
- Architecture
- Overall Architecture
- Frontend
- Backend
- WebSocket Protocol
- Data Pipeline
- Renderer
- Event System