Text Generation
Transformers
Safetensors
lfm2
liquid
unsloth
lfm2.5
edge
mermaid
diagram-generation
text-to-diagram
lfm
conversational
Instructions to use ali-thowfeek/Charty-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ali-thowfeek/Charty-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ali-thowfeek/Charty-1B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ali-thowfeek/Charty-1B") model = AutoModelForCausalLM.from_pretrained("ali-thowfeek/Charty-1B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ali-thowfeek/Charty-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ali-thowfeek/Charty-1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ali-thowfeek/Charty-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ali-thowfeek/Charty-1B
- SGLang
How to use ali-thowfeek/Charty-1B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ali-thowfeek/Charty-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ali-thowfeek/Charty-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ali-thowfeek/Charty-1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ali-thowfeek/Charty-1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use ali-thowfeek/Charty-1B with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ali-thowfeek/Charty-1B to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for ali-thowfeek/Charty-1B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for ali-thowfeek/Charty-1B to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="ali-thowfeek/Charty-1B", max_seq_length=2048, ) - Docker Model Runner
How to use ali-thowfeek/Charty-1B with Docker Model Runner:
docker model run hf.co/ali-thowfeek/Charty-1B
| library_name: transformers | |
| license: other | |
| license_name: lfm1.0 | |
| license_link: LICENSE | |
| language: | |
| - en | |
| - ar | |
| - zh | |
| - fr | |
| - de | |
| - ja | |
| - ko | |
| - es | |
| pipeline_tag: text-generation | |
| tags: | |
| - liquid | |
| - unsloth | |
| - lfm2.5 | |
| - edge | |
| - mermaid | |
| - diagram-generation | |
| - text-to-diagram | |
| - lfm | |
| base_model: | |
| - unsloth/LFM2.5-1.2B-Instruct | |
| datasets: | |
| - ali-thowfeek/text-to-mermaid | |
| # Charty-1B | |
| A compact text-to-Mermaid diagram generation model fine-tuned from Liquid AI's LFM2.5-1.2B-Instruct, built for on-device and mobile deployment. Give it a natural-language description and Charty-1B outputs raw Mermaid syntax only β no explanations, no markdown fences, no conversational filler. | |
| This repository contains the merged full model in 16-bit safetensors format. | |
| For quantized GGUF versions (F16 / Q8 / Q4K_M), see [ali-thowfeek/Charty-1B-GGUF](https://huggingface.co/ali-thowfeek/Charty-1B-GGUF) | |
| ## ποΈ Model Details | |
| | Field | Value | | |
| |---|---| | |
| | Base model | unsloth/LFM2.5-1.2B-Instruct | | |
| | Architecture | LFM2 (hybrid: 10 double-gated LIV convolution blocks + 6 GQA attention blocks) | | |
| | Parameters | 1.17B | | |
| | Context length | 32,768 tokens | | |
| | Vocabulary size | 65,536 | | |
| | Fine-tuning method | LoRA (SFT) via Unsloth + Hugging Face TRL | | |
| | Training dataset | ali-thowfeek/text-to-mermaid (3,837 examples) | | |
| | Developed by | ali-thowfeek | | |
| ## π¬ Chat Template (Unsloth's Fixed Template) | |
| This model ships with Unsloth's fixed Jinja chat template, inherited from the base repo. | |
| The same template is embedded in the GGUF builds (see the GGUF repo) and is applied automatically by llama.cpp with --jinja. | |
| ## π― Intended Use | |
| Generate Mermaid diagram syntax (flowcharts, sequence, class, state, ER, Gantt, pie, git graphs, mindmaps, quadrant charts, β¦) from plain-text prompts. | |
| Run on low-end hardware: mobile phones, edge devices, laptops, embedded systems. | |
| Power apps that need offline, private, diagram-as-code generation. | |
| ### What it does | |
| Input (user prompt): | |
| Create a flowchart showing the user login process with MFA verification. | |
| Output (model response): | |
| ```mermaid | |
| graph TD | |
| A[User Visits Login Page] --> B[Enter Credentials] | |
| B --> C{Credentials Valid?} | |
| C -->|No| D[Show Error Message] | |
| D --> B | |
| C -->|Yes| E[Send MFA Code] | |
| E --> F[Enter MFA Code] | |
| F --> G{MFA Valid?} | |
| G -->|No| H[Show MFA Error] | |
| H --> F | |
| G -->|Yes| I[Grant Access] | |
| ``` | |
| The model outputs only the Mermaid syntax code. No wrapping text, no mermaid fences. | |
| ## π Inference | |
| Recommended Generation Parameters | |
| | Parameter | Value | | |
| |---|---| | |
| | temperature | 0.1 | | |
| | top_k | 50 | | |
| | top_p | 0.1 | | |
| | repetition_penalty | 1.05 | | |
| ## π¦ GGUF / Quantized Versions | |
| For CPU-only inference, mobile deployment, or use with llama.cpp / Ollama / LM Studio: | |
| π [ali-thowfeek/Charty-1B-GGUF](https://huggingface.co/ali-thowfeek/Charty-1B-GGUF) | |
| | Quantization | Use Case | | |
| |---|---| | |
| | F16 | Maximum quality, larger memory footprint | | |
| | Q8_0 | Near-lossless quality, balanced size | | |
| | Q4KM | Smallest size, best for mobile / edge | | |
| ## π Training Details | |
| | Detail | Value | | |
| |---|---| | |
| | Framework | Unsloth + Hugging Face TRL | | |
| | Method | LoRA Supervised Fine-Tuning (SFT), merged into full weights | | |
| | Dataset | ali-thowfeek/text-to-mermaid | | |
| | Dataset size | 3,837 examples | | |
| | Dataset source | Derived from Celiadraw/text-to-mermaid-2, cleaned, reworded, and validated against Mermaid v11 (core) | | |
| | Validation | 100% of training examples produce valid Mermaid v11 core syntax | | |
| | Output format | Raw Mermaid syntax only (no markdown fences, no explanations) | | |
| ## π License | |
| This model is a derivative work of [LFM2.5-1.2B-Instruct](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Instruct) by Liquid AI and is released under the **[LFM Open License v1.0](https://huggingface.co/LiquidAI/LFM2.5-1.2B-Instruct/blob/main/LICENSE)**. | |
| Key terms: | |
| - β Free for research, personal, and non-commercial use. | |
| - β Commercial use permitted for entities with **< $10M annual revenue**. | |
| - β Commercial use by entities with **β₯ $10M annual revenue** is **not** licensed. | |
| - You must include a copy of the [LICENSE](../../blob/main/LICENSE) with any redistribution. | |
| - You must retain all copyright and attribution notices. | |
| See the full [LICENSE](../../blob/main/LICENSE) file in this repository for complete terms. | |
| ## π Citation | |
| If you use this model, please cite the base model and this work: | |
| ```bibtex | |
| @article{liquidai2025lfm2, | |
| title = {LFM2 Technical Report}, | |
| author = {Liquid AI}, | |
| journal = {arXiv preprint arXiv:2511.23404}, | |
| year = {2025} | |
| } | |
| @misc{thowfeek2026charty, | |
| title = {Charty-1B: A Text-to-Mermaid Diagram Generation Model}, | |
| author = {ali-thowfeek}, | |
| year = {2026}, | |
| url = {https://huggingface.co/ali-thowfeek/Charty-1B} | |
| } | |
| ``` | |
| ## π Acknowledgements | |
| - [Liquid AI](https://www.liquid.ai/) β LFM2.5 base model | |
| - [Unsloth](https://github.com/unslothai/unsloth) β 2Γ faster fine-tuning framework | |
| - [Celiadraw](https://huggingface.co/Celiadraw) β Original text-to-mermaid dataset source | |
| - [Hugging Face](https://huggingface.co/) β TRL library and model hosting |