🚀 Pipable的pipSQL
Pipable的pipSQL是一個從llama 1b蒸餾而來的模型,可根據給定的提示和模式生成SQL查詢。該模型在許多基準測試的SQL任務中表現優於ChatGPT和Claude。
🚀 快速開始
請參考https://huggingface.co/PipableAI/pipSQL-1.3b獲取我們的先進模型,它在許多基準測試的SQL任務中比ChatGPT和Claude表現更好。
✨ 主要特性
Pipable的pipSQL使用了獨特的管道,讓模型交替完成兩個目標:
- 最大化序列中所有標記(包括提示標記)的對數概率。
- 最小化輸出標記(即整個序列中SQL查詢部分的生成標記)的真實值與預測最大值之間的差異。
📦 安裝指南
暫未提供相關安裝步驟。
💻 使用示例
基礎用法
text = """<schema>{schema}</schema>
<question>{question}</question>
<sql>"""
高級用法
PyTorch
from transformers import AutoModelForCasualLM, AutoTokenizer
device = "cuda"
model = AutoModelForCausalLM.from_pretrained("PipableAI/pipSQL1b")
tokenizer = AutoTokenizer.from_pretrained("PipableAI/pipSQL1b")
inputs = tokenizer(text, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True).split('<sql>')[1].split('</sql>')[0])
Flax
from transformers import FlaxAutoModelForCasualLM, AutoTokenizer
model = FlaxAutoModelForCausalLM.from_pretrained("PipableAI/pipSQL1b" , from_pt=True)
tokenizer = AutoTokenizer.from_pretrained("PipableAI/pipSQL1b")
📚 詳細文檔
模型信息
屬性 |
詳情 |
模型類型 |
從llama 1b蒸餾而來的文本生成模型 |
訓練數據 |
PipableAI/spider-bird |
評估指標 |
準確率 |
標籤 |
code、sql、text2sql、instruction_tuned、jax、pytorch、1b、expert |
示例輸入
<schema>CREATE TABLE radio(age VARCHAR, radio_id VARCHAR, frequency VARCHAR, wavelength VARCHAR); CREATE TABLE radio_faults(radio_id VARCHAR, fault_description VARCHAR)</schema><question>Get the radio id and defect descriptions of radios that have wavelength greater than 30 ?</question><sql>
<schema>CREATE TABLE system(JobID: String,GID: String, UID: String, Start:Time(yyyy/mm/dd), End: Time,ElapsedRaw: Time, CPUTimeRAW: Time,NCPUS: Number,NNodes: Number, NodeList: List, State:String, Timelimit: Time);</schema><question>Get UID and job id for Jobs that started on Jan 20 , 2023</question><sql>
<schema>CREATE TABLE department (Department_ID number, Name text, Creation text, Ranking number, Budget_in_Billions number, Num_Employees number) which has Department_ID as primary key abd CREATE TABLE head (head_ID number, name text, born_state text, age number) which has head_ID as primary key and CREATE TABLE management (department_ID number, head_ID number, temporary_acting text) which has department_ID as primary key</schema><question>
📄 許可證
該模型的新權重以及所有相關資產均在MIT許可證下開源。
👥 PipableAI團隊
Avi Kothari、Pratham Gupta、Ritvik Aryan Kalra、Rohan Bhatial、Soham Acharya