🚀 ChartGPT 模型卡片
ChartGPT 是一個用於從自然語言生成圖表的語言模型。它基於 FLAN - T5 - XL 進行微調,能根據用戶輸入的自然語言描述和數據信息,逐步生成圖表的相關設置,如選擇列、添加過濾條件、選擇圖表類型等。
🚀 快速開始
在 GPU 上運行模型
以電影數據集和 “What kinds of movies are the most popular?” 這個自然語言描述為例,模型應給出步驟 1(選擇列)的答案。你可以使用以下代碼測試是否能成功運行模型。
點擊展開
from transformers import (
AutoTokenizer,
AutoModelForSeq2SeqLM,
)
tokenizer = AutoTokenizer.from_pretrained("yuan-tian/chartgpt")
model = AutoModelForSeq2SeqLM.from_pretrained("yuan-tian/chartgpt", device_map="auto")
input_text = "movies <head> Title,Worldwide_Gross,Production_Budget,Release_Year,Content_Rating,Running_Time,Major_Genre,Creative_Type,Rotten_Tomatoes_Rating,IMDB_Rating <type> nominal,quantitative,quantitative,temporal,nominal,quantitative,nominal,nominal,quantitative,quantitative <data> From Dusk Till Dawn,25728961,20000000,1996,R,107,Horror,Fantasy,63,7.1 <line> Broken Arrow,148345997,65000000,1996,R,108,Action,Contemporary Fiction,55,5.8 <line> <utterance> What kinds of movies are the most popular? <ans> <sep> Step 1. Select the columns:"
inputs = tokenizer(input_text, return_tensors="pt", padding=True).to("cuda")
outputs = model.generate(**inputs)
print(tokenizer.decode(outputs[0], skip_special_tokens = True))
✨ 主要特性
- 自然語言生成圖表:能夠根據自然語言描述生成相應的圖表設置。
- 多步驟交互:通過一系列步驟提示,逐步生成圖表的詳細信息。
📚 詳細文檔
模型詳情
模型描述
此模型用於從自然語言生成圖表。更多信息請參考相關論文。
模型輸入格式
點擊展開
第 x
步的模型輸入。具體而言,<...>
用作分隔符。
{表名}
<head> {列名}
<type> {列類型}
<data> {數據行 1} <line> {數據行 2} <line>
<utterance> {自然語言描述}
<ans>
<sep> {步驟 1 提示} {答案 2}
...
<sep> {步驟 x - 1 提示} {答案 x - 1}
<sep> {步驟 x 提示}
模型應輸出對應步驟 x
的答案。
步驟 1 - 6 的提示如下:
步驟 1. 選擇列:
步驟 2. 添加過濾條件:
步驟 3. 添加聚合操作:
步驟 4. 選擇圖表類型:
步驟 5. 選擇編碼方式:
步驟 6. 添加排序:
訓練詳情
訓練數據
該模型在 chartgpt - dataset 上對 FLAN - T5 - XL 進行微調。
訓練過程
計劃在未來更新預處理和訓練過程。
📄 許可證
本模型採用 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}
}