File size: 5,812 Bytes
abc485a 2138616 abc485a 6b23fa9 abc485a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
---
license: apache-2.0
language:
- en
library_name: transformers
tags:
- manim
- code-generation
- animation
- python
- fine-tuned
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
datasets:
- generaleoley/manim-codegen
pipeline_tag: text-generation
---
# π VLQM-1.5B-Coder
**A fine-tuned language model for generating Manim animation code from natural language descriptions.**
[](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct)
[](https://github.com/ml-explore/mlx)
[](LICENSE)
---
## π Model Description
**VLQM-1.5B-Coder** is a specialized language model fine-tuned to generate [Manim](https://www.manim.community/) Python code from natural language descriptions. Manim is the mathematical animation engine famously used by 3Blue1Brown.
### What This Model Does
Given a natural language prompt:
```
"Create a blue circle that moves to the right"
```
The model generates valid Manim Python code:
```python
from manim import *
class GenScene(Scene):
def construct(self):
circle = Circle(color=BLUE)
self.add(circle)
self.play(circle.animate.shift(RIGHT * 3))
```
---
## π― Intended Use
- **Primary Use**: Generating Manim animation code from text descriptions
- **Users**: Developers, educators, content creators making math/science animations
- **Languages**: English prompts, Python code output
### Example Use Cases
- Creating educational math animations
- Generating visualizations for presentations
- Prototyping Manim scenes quickly
- Learning Manim syntax through examples
---
## π Training Details
| Property | Value |
|----------|-------|
| **Base Model** | `Qwen/Qwen2.5-Coder-1.5B-Instruct` |
| **Parameters** | 1.5 Billion |
| **Training Method** | LoRA (Low-Rank Adaptation) |
| **Dataset** | [`generaleoley/manim-codegen`](https://huggingface.co/datasets/generaleoley/manim-codegen) |
| **Training Examples** | 1,459 |
| **Validation Examples** | 163 |
| **Training Framework** | Apple MLX |
| **Hardware** | MacBook Pro (Apple Silicon) |
### Hyperparameters
| Parameter | Value |
|-----------|-------|
| Iterations | 300 |
| Batch Size | 2 |
| Gradient Accumulation | 8 |
| Learning Rate | 5e-5 |
| LoRA Layers | 16 |
| Max Sequence Length | 8,192 |
---
---
## π Model Performance
### Training Loss Curve
The model shows a strong convergence pattern, with validation loss stabilizing around **0.71** and training loss reaching **0.48**.

## β οΈ Limitations
### Known Limitations
1. **Complex Animations**: May struggle with multi-step animations involving many objects
2. **Advanced Manim Features**: Less reliable with 3D scenes, complex graphs, or advanced camera movements
3. **API Hallucinations**: Sometimes generates non-existent Manim methods (e.g., `axes.get_sine()`)
4. **Indentation Issues**: Occasionally produces incorrectly indented code
5. **Long Prompts**: Performance degrades with very long or complex descriptions
### What This Model is NOT
- β Not a general-purpose code generator
- β Not trained for non-Manim Python code
- β Not suitable for production without human review
- β Not a replacement for learning Manim fundamentals
### Recommended Practices
- β
Always review and test generated code before use
- β
Use simple, clear prompts for best results
- β
Keep prompts focused on one animation at a time
- β
Be prepared to make minor edits to fix issues
---
## π Quick Start
### Using with Transformers (Cross-Platform)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"vikramlingam/VLQM-1.5B-Coder",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("vikramlingam/VLQM-1.5B-Coder")
prompt = "Create a red square that rotates"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0]))
```
### Using with MLX (Apple Silicon)
```bash
python -m mlx_lm.generate \
--model vikramlingam/VLQM-1.5B-Coder \
--prompt "Create a circle animation" \
--max-tokens 256
```
---
## π Model Files
```
VLQM-1.5B-Coder/
βββ config.json # Model configuration
βββ model.safetensors # Model weights (~3 GB)
βββ tokenizer.json # Tokenizer
βββ tokenizer_config.json
βββ vocab.json
βββ merges.txt
βββ generation_config.json
βββ special_tokens_map.json
βββ README.md # This file
```
---
## π License
This model is released under the **Apache 2.0 License**.
- β
Commercial use allowed
- β
Modification allowed
- β
Distribution allowed
- β οΈ Must include license and copyright notice
---
## π Acknowledgments
- **Base Model**: [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) by Alibaba
- **Dataset**: [generaleoley/manim-codegen](https://huggingface.co/datasets/generaleoley/manim-codegen)
- **Training Framework**: [Apple MLX](https://github.com/ml-explore/mlx)
- **Animation Engine**: [Manim Community](https://www.manim.community/)
---
## π¬ Citation
If you use this model, please cite:
```bibtex
@misc{vlqm-1.5b-coder,
author = {Vikram Lingam},
title = {VLQM-1.5B-Coder: Manim Code Generation Model},
year = {2025},
publisher = {Hugging Face},
url = {https://huggingface.co/vikramlingam/VLQM-1.5B-Coder}
}
```
---
## π Model Card Contact
For questions or issues, please open a discussion on the model's Hugging Face page.
|