Create README.md
This commit is contained in:
121
README.md
121
README.md
@@ -1,47 +1,86 @@
|
||||
---
|
||||
license: Apache License 2.0
|
||||
|
||||
#model-type:
|
||||
##如 gpt、phi、llama、chatglm、baichuan 等
|
||||
#- gpt
|
||||
|
||||
#domain:
|
||||
##如 nlp、cv、audio、multi-modal
|
||||
#- nlp
|
||||
|
||||
#language:
|
||||
##语言代码列表 https://help.aliyun.com/document_detail/215387.html?spm=a2c4g.11186623.0.0.9f8d7467kni6Aa
|
||||
#- cn
|
||||
|
||||
#metrics:
|
||||
##如 CIDEr、Blue、ROUGE 等
|
||||
#- CIDEr
|
||||
|
||||
#tags:
|
||||
##各种自定义,包括 pretrained、fine-tuned、instruction-tuned、RL-tuned 等训练方法和其他
|
||||
#- pretrained
|
||||
|
||||
#tools:
|
||||
##如 vllm、fastchat、llamacpp、AdaSeq 等
|
||||
#- vllm
|
||||
license: cc-by-sa-4.0
|
||||
library_name: transformers
|
||||
pipeline_tag: text-generation
|
||||
base_model: defog/sqlcoder-7b-2
|
||||
---
|
||||
### 当前模型的贡献者未提供更加详细的模型介绍。模型文件和权重,可浏览“模型文件”页面获取。
|
||||
#### 您可以通过如下git clone命令,或者ModelScope SDK来下载模型
|
||||
|
||||
SDK下载
|
||||
```bash
|
||||
#安装ModelScope
|
||||
pip install modelscope
|
||||
# QuantFactory/sqlcoder-7b-2-GGUF
|
||||
This is quantized version of [defog/sqlcoder-7b-2](https://huggingface.co/defog/sqlcoder-7b-2) created using llama.cpp
|
||||
|
||||
# Model Card for SQLCoder-7B-2
|
||||
|
||||
A capable large language model for natural language to SQL generation.
|
||||
|
||||

|
||||
|
||||
## Model Details
|
||||
|
||||
### Model Description
|
||||
|
||||
<!-- Provide a longer summary of what this model is. -->
|
||||
|
||||
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
||||
|
||||
- **Developed by:** [Defog, Inc](https://defog.ai)
|
||||
- **Model type:** [Text to SQL]
|
||||
- **License:** [CC-by-SA-4.0]
|
||||
- **Finetuned from model:** [CodeLlama-7B]
|
||||
|
||||
### Model Sources [optional]
|
||||
- [**HuggingFace:**](https://huggingface.co/defog/sqlcoder-70b-alpha)
|
||||
- [**GitHub:**](https://github.com/defog-ai/sqlcoder)
|
||||
- [**Demo:**](https://defog.ai/sqlcoder-demo/)
|
||||
|
||||
## Uses
|
||||
|
||||
This model is intended to be used by non-technical users to understand data inside their SQL databases. It is meant as an analytics tool, and not as a database admin tool.
|
||||
|
||||
This model has not been trained to reject malicious requests from users with write access to databases, and should only be used by users with read-only access.
|
||||
|
||||
## How to Get Started with the Model
|
||||
|
||||
Use the code [here](https://github.com/defog-ai/sqlcoder/blob/main/inference.py) to get started with the model.
|
||||
|
||||
## Prompt
|
||||
|
||||
Please use the following prompt for optimal results. Please remember to use `do_sample=False` and `num_beams=4` for optimal results.
|
||||
|
||||
```
|
||||
```python
|
||||
#SDK模型下载
|
||||
from modelscope import snapshot_download
|
||||
model_dir = snapshot_download('QuantFactory/sqlcoder-7b-2-GGUF')
|
||||
```
|
||||
Git下载
|
||||
```
|
||||
#Git模型下载
|
||||
git clone https://www.modelscope.cn/QuantFactory/sqlcoder-7b-2-GGUF.git
|
||||
### Task
|
||||
Generate a SQL query to answer [QUESTION]{user_question}[/QUESTION]
|
||||
|
||||
### Database Schema
|
||||
The query will run on a database with the following schema:
|
||||
{table_metadata_string_DDL_statements}
|
||||
|
||||
### Answer
|
||||
Given the database schema, here is the SQL query that [QUESTION]{user_question}[/QUESTION]
|
||||
[SQL]
|
||||
```
|
||||
|
||||
<p style="color: lightgrey;">如果您是本模型的贡献者,我们邀请您根据<a href="https://modelscope.cn/docs/ModelScope%E6%A8%A1%E5%9E%8B%E6%8E%A5%E5%85%A5%E6%B5%81%E7%A8%8B%E6%A6%82%E8%A7%88" style="color: lightgrey; text-decoration: underline;">模型贡献文档</a>,及时完善模型卡片内容。</p>
|
||||
## Evaluation
|
||||
|
||||
This model was evaluated on [SQL-Eval](https://github.com/defog-ai/sql-eval), a PostgreSQL based evaluation framework developed by Defog for testing and alignment of model capabilities.
|
||||
|
||||
You can read more about the methodology behind SQLEval [here](https://defog.ai/blog/open-sourcing-sqleval/).
|
||||
|
||||
### Results
|
||||
|
||||
We classified each generated question into one of 6 categories. The table displays the percentage of questions answered correctly by each model, broken down by category.
|
||||
|
||||
| | date | group_by | order_by | ratio | join | where |
|
||||
| -------------- | ---- | -------- | -------- | ----- | ---- | ----- |
|
||||
| sqlcoder-70b | 96 | 91.4 | 97.1 | 85.7 | 97.1 | 91.4 |
|
||||
| sqlcoder-7b-2 | 96 | 91.4 | 94.3 | 91.4 | 94.3 | 77.1 |
|
||||
| sqlcoder-34b | 80 | 94.3 | 85.7 | 77.1 | 85.7 | 80 |
|
||||
| gpt-4 | 72 | 94.3 | 97.1 | 80 | 91.4 | 80 |
|
||||
| gpt-4-turbo | 76 | 91.4 | 91.4 | 62.8 | 88.6 | 77.1 |
|
||||
| natural-sql-7b | 56 | 88.6 | 85.7 | 60 | 88.6 | 80 |
|
||||
| sqlcoder-7b | 64 | 82.9 | 74.3 | 54.3 | 74.3 | 74.3 |
|
||||
| gpt-3.5 | 72 | 77.1 | 82.8 | 34.3 | 65.7 | 71.4 |
|
||||
| claude-2 | 52 | 71.4 | 74.3 | 57.1 | 65.7 | 62.9 |
|
||||
|
||||
## Model Card Contact
|
||||
|
||||
Contact us on X at [@defogdata](https://twitter.com/defogdata), or on email at [founders@defog.ai](mailto:founders@defog.ai)
|
||||
Reference in New Issue
Block a user