SpyroSigma commited on
Commit
491b679
·
verified ·
1 Parent(s): ba0eb22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -19
app.py CHANGED
@@ -3,25 +3,14 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
3
 
4
  model_name = "defog/sqlcoder-7b-2"
5
  tokenizer = AutoTokenizer.from_pretrained(model_name)
6
- if available_memory > 15e9:
7
- # if you have atleast 15GB of GPU memory, run load the model in float16
8
- model = AutoModelForCausalLM.from_pretrained(
9
- model_name,
10
- trust_remote_code=True,
11
- torch_dtype=torch.float16,
12
- device_map="auto",
13
- use_cache=True,
14
- )
15
- else:
16
- # else, load in 8 bits – this is a bit slower
17
- model = AutoModelForCausalLM.from_pretrained(
18
- model_name,
19
- trust_remote_code=True,
20
- # torch_dtype=torch.float16,
21
- load_in_8bit=True,
22
- device_map="auto",
23
- use_cache=True,
24
- )
25
 
26
  prompt = """### Task
27
  Generate a SQL query to answer [QUESTION]{question}[/QUESTION]
 
3
 
4
  model_name = "defog/sqlcoder-7b-2"
5
  tokenizer = AutoTokenizer.from_pretrained(model_name)
6
+ model = AutoModelForCausalLM.from_pretrained(
7
+ model_name,
8
+ trust_remote_code=True,
9
+ # torch_dtype=torch.float16,
10
+ load_in_8bit=True,
11
+ device_map="auto",
12
+ use_cache=True,
13
+ )
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  prompt = """### Task
16
  Generate a SQL query to answer [QUESTION]{question}[/QUESTION]