Views
No views yet
SELECT queries.1from transformers import AutoTokenizer, AutoModelForCausalLM
2tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-6B")
3model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-6B")
4
5text = """CREATE TABLE stadium (
6 stadium_id number,
7 location text,
8 name text,
9 capacity number,
10 highest number,
11 lowest number,
12 average number
13)
14
15CREATE TABLE singer (
16 singer_id number,
17 name text,
18 country text,
19 song_name text,
20 song_release_year text,
21 age number,
22 is_male others
23)
24
25CREATE TABLE concert (
26 concert_id number,
27 concert_name text,
28 theme text,
29 stadium_id text,
30 year text
31)
32
33CREATE TABLE singer_in_concert (
34 concert_id number,
35 singer_id text
36)
37
38-- Using valid SQLite, answer the following questions for the tables provided above.
39
40-- What is the maximum, the average, and the minimum capacity of stadiums ?
41
42SELECT"""
43
44input_ids = tokenizer(text, return_tensors="pt").input_ids
45
46generated_ids = model.generate(input_ids, max_length=500)
47print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))1from transformers import AutoTokenizer, AutoModelForCausalLM
2tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-6B")
3model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-6B")
4
5text = """CREATE TABLE stadium (
6 stadium_id number,
7 location text,
8 name text,
9 capacity number,
10)
11
12-- Using valid SQLite, answer the following questions for the tables provided above.
13
14-- how many stadiums in total?
15
16SELECT"""
17
18input_ids = tokenizer(text, return_tensors="pt").input_ids
19
20generated_ids = model.generate(input_ids, max_length=500)
21print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))1from transformers import AutoTokenizer, AutoModelForCausalLM
2tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-6B")
3model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-6B")
4
5text = """CREATE TABLE work_orders (
6 ID NUMBER,
7 CREATED_AT TEXT,
8 COST FLOAT,
9 INVOICE_AMOUNT FLOAT,
10 IS_DUE BOOLEAN,
11 IS_OPEN BOOLEAN,
12 IS_OVERDUE BOOLEAN,
13 COUNTRY_NAME TEXT,
14)
15
16-- Using valid SQLite, answer the following questions for the tables provided above.
17
18-- how many work orders are open?
19
20SELECT"""
21
22input_ids = tokenizer(text, return_tensors="pt").input_ids
23
24generated_ids = model.generate(input_ids, max_length=500)
25print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))