π§ mermaidGPT β Mermaid Diagram Generator from Natural Language
mermaidGPT is a small English-language model trained to generate valid Mermaid.js diagrams from natural language prompts. It allows users to create flowcharts, sequence diagrams, and more using simple instructions like βShow a user sending a request to a server.β Build with the dataset : Celiadraw/text-to-mermaid
π§° Features
- English-only natural language input
- Generates Mermaid.js graph code (flowcharts, sequence diagrams, etc.)
- GPT-like architecture using PyTorch
- Lightweight and fast (trainable on a single GPU)
- CLI-based usage for generation
- Can be extended with API or frontend
π¦ Project Structure
/
βββ train.py # Training script
βββ generate.py # Generate Mermaid code from prompt
βββ tokenizer.py # Tokenization utilities
βββ model.py # GPT-style model architecture
βββ data/ # Training data (if any)
βββ examples/ # Prompt examples and output
βββ checkpoints/ # Saved model checkpoints
βββ README.md
π Training
1. Build the tokenizer
python tokenizer.py
2. Train the model
python train.py
3. Hyperparameters
block_size = 128
batch_size = 32
learning_rate = 1e-3
embed_dim = 128
n_heads = 8
n_layers = 8
βοΈ Generation Example
Prompt:
Create a flowchart showing a user sending a request to a server and receiving a response.
Output:
graph TD
User -->|Request| Server
Server -->|Response| User
π License
This project is released under the MIT License. See the LICENSE
file for details.
π€ Model on Hugging Face
Test or download the model on Hugging Face:
π¦ https://huggingface.co/eric-houzelle/mermaidGPT
π¬ Contact
For any suggestions or questions: [email protected]
- Downloads last month
- 16