Views
No views yet
SELECT queries.1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-llama-2-7B")
4model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-llama-2-7B", torch_dtype=torch.bfloat16)
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)
14CREATE TABLE singer (
15 singer_id number,
16 name text,
17 country text,
18 song_name text,
19 song_release_year text,
20 age number,
21 is_male others
22)
23CREATE TABLE concert (
24 concert_id number,
25 concert_name text,
26 theme text,
27 stadium_id text,
28 year text
29)
30CREATE TABLE singer_in_concert (
31 concert_id number,
32 singer_id text
33)
34-- Using valid SQLite, answer the following questions for the tables provided above.
35-- What is the maximum, the average, and the minimum capacity of stadiums ?
36SELECT"""
37input_ids = tokenizer(text, return_tensors="pt").input_ids
38generated_ids = model.generate(input_ids, max_length=500)
39print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-llama-2-7B")
4model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-llama-2-7B", torch_dtype=torch.bfloat16)
5text = """CREATE TABLE stadium (
6 stadium_id number,
7 location text,
8 name text,
9 capacity number,
10)
11-- Using valid SQLite, answer the following questions for the tables provided above.
12-- how many stadiums in total?
13SELECT"""
14input_ids = tokenizer(text, return_tensors="pt").input_ids
15generated_ids = model.generate(input_ids, max_length=500)
16print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3tokenizer = AutoTokenizer.from_pretrained("NumbersStation/nsql-llama-2-7B")
4model = AutoModelForCausalLM.from_pretrained("NumbersStation/nsql-llama-2-7B", torch_dtype=torch.bfloat16)
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-- Using valid SQLite, answer the following questions for the tables provided above.
16-- how many work orders are open?
17SELECT"""
18input_ids = tokenizer(text, return_tensors="pt").input_ids
19generated_ids = model.generate(input_ids, max_length=500)
20print(tokenizer.decode(generated_ids[0], skip_special_tokens=True))