rootxhacker commited on
Commit
192a7b2
·
verified ·
1 Parent(s): 18ef497

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -8,12 +8,14 @@ import spaces
8
  peft_model_id = "rootxhacker/CodeAstra-7B"
9
  config = PeftConfig.from_pretrained(peft_model_id)
10
  model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_4bit=True, device_map='auto')
 
11
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
12
 
13
  # Load the Lora model
14
  model = PeftModel.from_pretrained(model, peft_model_id)
15
 
16
 
 
17
  @spaces.GPU(duration=200)
18
  def get_completion(query, model, tokenizer):
19
  inputs = tokenizer(query, return_tensors="pt")
 
8
  peft_model_id = "rootxhacker/CodeAstra-7B"
9
  config = PeftConfig.from_pretrained(peft_model_id)
10
  model = AutoModelForCausalLM.from_pretrained(config.base_model_name_or_path, return_dict=True, load_in_4bit=True, device_map='auto')
11
+ model.to('cuda')
12
  tokenizer = AutoTokenizer.from_pretrained(config.base_model_name_or_path)
13
 
14
  # Load the Lora model
15
  model = PeftModel.from_pretrained(model, peft_model_id)
16
 
17
 
18
+
19
  @spaces.GPU(duration=200)
20
  def get_completion(query, model, tokenizer):
21
  inputs = tokenizer(query, return_tensors="pt")