Upload model.py
Browse files
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'])
|