🚀 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}
}