Prasanna Dhungana commited on
Commit
356533d
1 Parent(s): a69cdec

updated app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -5,10 +5,11 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
5
 
6
 
7
  #Loading model
 
8
  model_path = "parsanna17/finetune_starcoder2_with_R_data"
9
  checkpoint = "bigcode/starcoder2-3b"
10
  config = PeftConfig.from_pretrained(model_path)
11
- model = AutoModelForCausalLM.from_pretrained(checkpoint, torch_dtype=torch.bfloat16)
12
  model = PeftModel.from_pretrained(model, model_path).to(device)
13
  tokenizer = AutoTokenizer.from_pretrained(checkpoint)
14
 
 
5
 
6
 
7
  #Loading model
8
+ device = "cuda" if torch.cuda.is_available() else "cpu"
9
  model_path = "parsanna17/finetune_starcoder2_with_R_data"
10
  checkpoint = "bigcode/starcoder2-3b"
11
  config = PeftConfig.from_pretrained(model_path)
12
+ model = AutoModelForCausalLM.from_pretrained(checkpoint,device=device, torch_dtype=torch.bfloat16)
13
  model = PeftModel.from_pretrained(model, model_path).to(device)
14
  tokenizer = AutoTokenizer.from_pretrained(checkpoint)
15