Skip to content

Commit

Permalink
Merge branch 'main' into repo_level_task_example_in_text
Browse files Browse the repository at this point in the history
  • Loading branch information
cyente committed Apr 18, 2024
2 parents 30ec6fc + 008d508 commit 29ea9c9
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<p>

<p align="center">
<img src="https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/assets/blog/codeqwen1.5/main.png" width="800"/>
<img src="https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/assets/blog/codeqwen1.5/intro.png" width="800"/>
<p>


Expand Down
116 changes: 116 additions & 0 deletions evaluation/text_to_sql/sql_bird_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<|im_start|>user
CREATE TABLE frpm
(
CDSCode TEXT not null
primary key,
`Academic Year` TEXT null,
`County Code` TEXT null,
`District Code` INTEGER null,
`School Code` TEXT null,
`County Name` TEXT null,
`District Name` TEXT null,
`School Name` TEXT null,
`District Type` TEXT null,
`School Type` TEXT null,
`Educational Option Type` TEXT null,
`NSLP Provision Status` TEXT null,
`Charter School (Y/N)` INTEGER null,
`Charter School Number` TEXT null,
`Charter Funding Type` TEXT null,
IRC INTEGER null,
`Low Grade` TEXT null,
`High Grade` TEXT null,
`Enrollment (K-12)` REAL null,
`Free Meal Count (K-12)` REAL null,
`Percent (%) Eligible Free (K-12)` REAL null,
`FRPM Count (K-12)` REAL null,
`Percent (%) Eligible FRPM (K-12)` REAL null,
`Enrollment (Ages 5-17)` REAL null,
`Free Meal Count (Ages 5-17)` REAL null,
`Percent (%) Eligible Free (Ages 5-17)` REAL null,
`FRPM Count (Ages 5-17)` REAL null,
`Percent (%) Eligible FRPM (Ages 5-17)` REAL null,
`2013-14 CALPADS Fall 1 Certification Status` INTEGER null,
foreign key (CDSCode) references schools (CDSCode)
);

CREATE TABLE satscores
(
cds TEXT not null
primary key,
rtype TEXT not null,
sname TEXT null,
dname TEXT null,
cname TEXT null,
enroll12 INTEGER not null,
NumTstTakr INTEGER not null,
AvgScrRead INTEGER null,
AvgScrMath INTEGER null,
AvgScrWrite INTEGER null,
NumGE1500 INTEGER null,
-- PctGE1500 double null,
foreign key (cds) references schools (CDSCode)
);

CREATE TABLE schools
(
CDSCode TEXT not null
primary key,
NCESDist TEXT null,
NCESSchool TEXT null,
StatusType TEXT not null,
County TEXT not null,
District TEXT not null,
School TEXT null,
Street TEXT null,
StreetAbr TEXT null,
City TEXT null,
Zip TEXT null,
State TEXT null,
MailStreet TEXT null,
MailStrAbr TEXT null,
MailCity TEXT null,
MailZip TEXT null,
MailState TEXT null,
Phone TEXT null,
Ext TEXT null,
Website TEXT null,
OpenDate DATE null,
ClosedDate DATE null,
Charter INTEGER null,
CharterNum TEXT null,
FundingType TEXT null,
DOC TEXT not null,
DOCType TEXT not null,
SOC TEXT null,
SOCType TEXT null,
EdOpsCode TEXT null,
EdOpsName TEXT null,
EILCode TEXT null,
EILName TEXT null,
GSoffered TEXT null,
GSserved TEXT null,
Virtual TEXT null,
Magnet INTEGER null,
Latitude REAL null,
Longitude REAL null,
AdmFName1 TEXT null,
AdmLName1 TEXT null,
AdmEmail1 TEXT null,
AdmFName2 TEXT null,
AdmLName2 TEXT null,
AdmEmail2 TEXT null,
AdmFName3 TEXT null,
AdmLName3 TEXT null,
AdmEmail3 TEXT null,
LastUpdate DATE not null
);

-- External Knowledge: Eligible free rate for K-12 = `Free Meal Count (K-12)` / `Enrollment (K-12)`

-- Using valid SQLite and understanding External Knowledge, answer the following questions for the tables provided above.

Question: What is the highest eligible free rate for K-12 students in the schools in Alameda County?

Please output only the final SQL query, starts with keyword `SELECT`.<|im_end|>
<|im_start|>assistant
78 changes: 78 additions & 0 deletions evaluation/text_to_sql/sql_spider_prompt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<|im_start|>user
CREATE TABLE "stadium" (
"Stadium_ID" int,
"Location" text,
"Name" text,
"Capacity" int,
"Highest" int,
"Lowest" int,
"Average" int,
PRIMARY KEY ("Stadium_ID")
);
/*
3 example rows:
SELECT * FROM stadium LIMIT 3;
Stadium_ID Location Name Capacity Highest Lowest Average
1 Raith Rovers Stark's Park 10104 4812 1294 2106
2 Ayr United Somerset Park 11998 2363 1057 1477
3 East Fife Bayview Stadium 2000 1980 533 864
*/

CREATE TABLE "singer" (
"Singer_ID" int,
"Name" text,
"Country" text,
"Song_Name" text,
"Song_release_year" text,
"Age" int,
"Is_male" bool,
PRIMARY KEY ("Singer_ID")
);
/*
3 example rows:
SELECT * FROM singer LIMIT 3;
Singer_ID Name Country Song_Name Song_release_year Age Is_male
1 Joe Sharp Netherlands You 1992 52 F
2 Timbaland United States Dangerous 2008 32 T
3 Justin Brown France Hey Oh 2013 29 T
*/

CREATE TABLE "concert" (
"concert_ID" int,
"concert_Name" text,
"Theme" text,
"Stadium_ID" text,
"Year" text,
PRIMARY KEY ("concert_ID"),
FOREIGN KEY ("Stadium_ID") REFERENCES "stadium"("Stadium_ID")
);
/*
3 example rows:
SELECT * FROM concert LIMIT 3;
concert_ID concert_Name Theme Stadium_ID Year
1 Auditions Free choice 1 2014
2 Super bootcamp Free choice 2 2 2014
3 Home Visits Bleeding Love 2 2015
*/

CREATE TABLE "singer_in_concert" (
"concert_ID" int,
"Singer_ID" text,
PRIMARY KEY ("concert_ID","Singer_ID"),
FOREIGN KEY ("concert_ID") REFERENCES "concert"("concert_ID"),
FOREIGN KEY ("Singer_ID") REFERENCES "singer"("Singer_ID")
);
/*
3 example rows:
SELECT * FROM singer_in_concert LIMIT 3;
concert_ID Singer_ID
1 2
1 3
1 5
*/

-- Using valid SQLite, answer the following questions for the tables provided above.
Question: How many singers do we have?

Please output only the final SQL query, starts with keyword `SELECT`.<|im_end|>
<|im_start|>assistant
32 changes: 32 additions & 0 deletions examples/CodeQwen1.5-base.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,35 @@ Generated text:
if __name__ == "__main__":
main()
```

# Use CodeQwen1.5-base By vllm
As a family member of Qwen1.5, CodeQwen1.5 are supported by vLLM. The detail tutorial could be found in [Qwen tutorial](https://qwen.readthedocs.io/en/latest/deployment/vllm.html).
Here, we only give you an simple example of offline batched inference in vLLM.

## Offline Batched Inference

```python
from transformers import AutoTokenizer
from vllm import LLM, SamplingParams
# Initialize the tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/CodeQwen1.5-7B")

# Pass the default decoding hyperparameters of Qwen1.5-7B-Chat
# max_tokens is for the maximum length for generation.
sampling_params = SamplingParams(temperature=0.7, top_p=0.8, repetition_penalty=1.05, max_tokens=1024)

# Input the model name or path. Can be GPTQ or AWQ models.
llm = LLM(model="Qwen/CodeQwen1.5-7B")

# Prepare your prompts
prompt = "#write a quick sort algorithm.\ndef quick_sort("

# generate outputs
outputs = llm.generate([prompt], sampling_params)

# Print the outputs.
for output in outputs:
prompt = output.prompt
generated_text = output.outputs[0].text
print(f"Prompt: {prompt!r}, Generated text: {generated_text!r}")
```
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ torch
transformers
accelerate
safetensors
vllm

0 comments on commit 29ea9c9

Please sign in to comment.