mohan1869 commited on
Commit
9978119
·
1 Parent(s): 2b89112

Deploy SQLCoder with Streamlit

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. requirements.txt +1 -0
app.py CHANGED
@@ -7,13 +7,13 @@ st.set_page_config(page_title="SQLCoder", layout="wide")
7
  # Load the model and tokenizer
8
  @st.cache_resource
9
  def load_model():
10
- # model_name = "defog/sqlcoder-7b-2"
11
- model_name = "EleutherAI/gpt-neo-1.3B"
12
  tokenizer = AutoTokenizer.from_pretrained(model_name)
13
  model = AutoModelForCausalLM.from_pretrained(
14
  model_name,
15
- device_map="auto", # Automatically uses GPU if available
16
- low_cpu_mem_usage=True # Optimizes memory usage
 
17
  )
18
  return tokenizer, model
19
 
 
7
  # Load the model and tokenizer
8
  @st.cache_resource
9
  def load_model():
10
+ model_name = "defog/sqlcoder-7b-2"
 
11
  tokenizer = AutoTokenizer.from_pretrained(model_name)
12
  model = AutoModelForCausalLM.from_pretrained(
13
  model_name,
14
+ device_map="auto",
15
+ load_in_8bit=True, # Use int8 quantization
16
+ low_cpu_mem_usage=True,
17
  )
18
  return tokenizer, model
19
 
requirements.txt CHANGED
@@ -2,3 +2,4 @@ transformers
2
  torch
3
  streamlit
4
  accelerate
 
 
2
  torch
3
  streamlit
4
  accelerate
5
+ bitsandbytes