Text Generation
Transformers
Safetensors
English
qwen2
code
conversational
text-generation-inference
Instructions to use TIGER-Lab/VisCoder-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TIGER-Lab/VisCoder-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TIGER-Lab/VisCoder-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/VisCoder-7B") model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/VisCoder-7B") 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]:])) - Inference
- Local Apps Settings
- vLLM
How to use TIGER-Lab/VisCoder-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TIGER-Lab/VisCoder-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/VisCoder-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TIGER-Lab/VisCoder-7B
- SGLang
How to use TIGER-Lab/VisCoder-7B 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 "TIGER-Lab/VisCoder-7B" \ --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": "TIGER-Lab/VisCoder-7B", "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 "TIGER-Lab/VisCoder-7B" \ --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": "TIGER-Lab/VisCoder-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TIGER-Lab/VisCoder-7B with Docker Model Runner:
docker model run hf.co/TIGER-Lab/VisCoder-7B
Update README.md
Browse files
README.md
CHANGED
|
@@ -8,4 +8,53 @@ base_model:
|
|
| 8 |
- Qwen/Qwen2.5-Coder-7B-Instruct
|
| 9 |
tags:
|
| 10 |
- code
|
| 11 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
- Qwen/Qwen2.5-Coder-7B-Instruct
|
| 9 |
tags:
|
| 10 |
- code
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# VisCoder-7B
|
| 14 |
+
|
| 15 |
+
[π Project Page](https://tiger-ai-lab.github.io/VisCoder) | [π Paper](https://arxiv.org/abs/2506.03930) | [π» GitHub](https://github.com/TIGER-AI-Lab/VisCoder) | [π€ Dataset: VisCode-200K](https://huggingface.co/datasets/TIGER-Lab/VisCode-200K)
|
| 16 |
+
|
| 17 |
+
**VisCoder-7B** is a large language model fine-tuned for **Python visualization code generation and multi-turn self-correction**. It is trained on **VisCode-200K**, a large-scale instruction-tuning dataset that integrates validated executable code, natural language instructions, and revision supervision from execution feedback.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
## π§ Model Description
|
| 21 |
+
|
| 22 |
+
**VisCoder-7B** is trained on **VisCode-200K**, a large-scale instruction-tuning dataset tailored for executable Python visualization tasks. It addresses a core challenge in data analysis: generating Python code that not only executes successfully but also produces **semantically meaningful plots** by aligning **natural language instructions**, **data structures**, and **visual outputs**.
|
| 23 |
+
|
| 24 |
+
We propose a **self-debug evaluation protocol** that simulates real-world developer workflows. In this setting, models are allowed to revise previously failed generations over multiple rounds with guidance from **execution feedback**.
|
| 25 |
+
|
| 26 |
+
## π Main Results on PandasPlotBench
|
| 27 |
+
|
| 28 |
+
We evaluate VisCoder-7B on [**PandasPlotBench**](https://github.com/TIGER-AI-Lab/VisCoder/tree/main/eval), which tests executable visualization code generation across three major libraries. Our benchmark covers both standard generation and **multi-round self-debugging**.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
|
| 32 |
+
> VisCoder-7B achieves over **90% execution pass rate** on both **Matplotlib** and **Seaborn** under the self-debug setting, outperforming open-source baselines and approaching GPT-4o performance.
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
## π Training Details
|
| 36 |
+
|
| 37 |
+
- **Base model**: Qwen2.5-Coder-7B-Instruct
|
| 38 |
+
- **Framework**: [ms-swift](https://github.com/modelscope/swift)
|
| 39 |
+
- **Tuning method**: Full-parameter supervised fine-tuning (SFT)
|
| 40 |
+
- **Dataset**: [VisCode-200K](https://huggingface.co/datasets/TIGER-Lab/VisCode-200K), which includes:
|
| 41 |
+
- 150K+ validated Python visualization samples with images
|
| 42 |
+
- 45K+ multi-turn correction dialogues with execution feedback
|
| 43 |
+
|
| 44 |
+
## π Citation
|
| 45 |
+
|
| 46 |
+
If you use VisCoder-7B or VisCode-200K in your research, please cite:
|
| 47 |
+
|
| 48 |
+
```bibtex
|
| 49 |
+
@misc{ni2025viscoderfinetuningllmsexecutable,
|
| 50 |
+
title={VisCoder: Fine-Tuning LLMs for Executable Python Visualization Code Generation},
|
| 51 |
+
author={Yuansheng Ni and Ping Nie and Kai Zou and Xiang Yue and Wenhu Chen},
|
| 52 |
+
year={2025},
|
| 53 |
+
eprint={2506.03930},
|
| 54 |
+
archivePrefix={arXiv},
|
| 55 |
+
primaryClass={cs.SE},
|
| 56 |
+
url={https://arxiv.org/abs/2506.03930}
|
| 57 |
+
}
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
For evaluation scripts and more information, see our [GitHub repository](https://github.com/TIGER-AI-Lab/VisCoder).
|