zhengr commited on
Commit
a4c93a9
·
verified ·
1 Parent(s): 88aa397

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -32,6 +32,8 @@ streamer = TextStreamer(tokenizer)
32
 
33
  model = AutoModelForCausalLM.from_pretrained(model, trust_remote_code=True, device_map="cuda")
34
  model = PeftModel.from_pretrained(model, peft_model)
 
 
35
  model.to(device)
36
 
37
  model = model.eval()
 
32
 
33
  model = AutoModelForCausalLM.from_pretrained(model, trust_remote_code=True, device_map="cuda")
34
  model = PeftModel.from_pretrained(model, peft_model)
35
+
36
+ device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
37
  model.to(device)
38
 
39
  model = model.eval()