🚀 ChartGPT-Llama3 模型卡
ChartGPT-Llama3 模型可根据自然语言生成图表,为数据可视化提供了便捷的解决方案,有效提升了从文本到图表的转换效率。
🚀 快速开始
在 GPU 上运行模型
以一个电影数据集为例,指令为“以教职工的职业状态给出可视化展示”。模型应给出所有步骤的答案。你可以使用以下代码测试是否能成功运行模型。
点击展开
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
)
tokenizer = AutoTokenizer.from_pretrained("yuan-tian/chartgpt-llama3")
model = AutoModelForCausalLM.from_pretrained("yuan-tian/chartgpt-llama3", device_map="auto")
input_text = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
Your response should follow the following format:
Step 1. Select the columns:
Step 2. Filter the data:
Step 3. Add aggregate functions:
Step 4. Choose chart type:
Step 5. Select encodings:
Step 6. Sort the data:
### Instruction:
Give me a visual representation of the faculty members by their professional status.
### Input:
Table Name: Faculty
Table Header: FacID,Lname,Fname,Rank,Sex,Phone,Room,Building
Table Header Type: quantitative,nominal,nominal,nominal,nominal,quantitative,nominal,nominal
Table Data Example:
1082,Giuliano,Mark,Instructor,M,2424,224,NEB
1121,Goodrich,Michael,Professor,M,3593,219,NEB
Previous Answer:
### Response:"""
inputs = tokenizer(input_text, return_tensors="pt", padding=True).to("cuda")
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens = True))
✨ 主要特性
- 此模型用于根据自然语言生成图表,更多信息请参考相关论文。
📦 安装指南
暂未提供相关安装步骤。
📚 详细文档
模型详情
模型描述
该模型用于根据自然语言生成图表。更多信息请参考论文。
模型输入格式
点击展开
步骤 x
的模型输入。
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
Your response should follow the following format:
{Step 1 prompt}
{Step x-1 prompt}
{Step x prompt}
### Instruction:
{instruction}
### Input:
Table Name: {table name}
Table Header: {column names}
Table Header Type: {column types}
Table Data Example:
{data row 1}
{data row 2}
Previous Answer:
{previous answer}
### Response:
模型应输出对应步骤 x
的答案。
步骤 1 - 6 的提示如下:
Step 1. Select the columns:
Step 2. Filter the data:
Step 3. Add aggregate functions:
Step 4. Choose chart type:
Step 5. Select encodings:
Step 6. Sort the data:
训练详情
训练数据
此模型在 chartgpt-dataset-llama3 数据集上对 Meta-Llama-3-8B-Instruct 进行微调。
训练过程
计划在未来更新预处理和训练过程。
📄 许可证
本模型使用的许可证为 Apache 2.0。
📖 引用
BibTeX:
@article{tian2024chartgpt,
title={ChartGPT: Leveraging LLMs to Generate Charts from Abstract Natural Language},
author={Tian, Yuan and Cui, Weiwei and Deng, Dazhen and Yi, Xinjing and Yang, Yurun and Zhang, Haidong and Wu, Yingcai},
journal={IEEE Transactions on Visualization and Computer Graphics},
year={2024},
pages={1-15},
doi={10.1109/TVCG.2024.3368621}
}