ayushshah commited on
Commit
12a6660
·
1 Parent(s): c9669c2

Upload model.py

Browse files
Files changed (1) hide show
  1. model.py +1 -1
model.py CHANGED
@@ -23,7 +23,7 @@ def infer_reviews(reviews, model, tokenizer):
23
  if is_single:
24
  reviews = [reviews]
25
 
26
- inputs = tokenizer(reviews, return_tensors="pt", truncation=True, padding=True, max_length=512).to('cuda')
27
 
28
  with torch.no_grad():
29
  logits = model(inputs['input_ids'], inputs['attention_mask'])
 
23
  if is_single:
24
  reviews = [reviews]
25
 
26
+ inputs = tokenizer(reviews, return_tensors="pt", truncation=True, padding=True, max_length=512).to('cuda' if torch.cuda.is_available() else 'cpu')
27
 
28
  with torch.no_grad():
29
  logits = model(inputs['input_ids'], inputs['attention_mask'])