nppmatt commited on
Commit
9510774
·
1 Parent(s): e293fc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -41,9 +41,11 @@ model = AutoModelForSequenceClassification.from_pretrained(modelPath)
41
  # RoBERTA: [0]: neutral, [1]: toxic
42
  encoding = tokenizer.encode(txt, return_tensors='pt')
43
  result = model(encoding)
 
44
  result
45
- pad = (0, 1)
46
- result = nn.functional.pad(result.logits, pad, "constant", 0)
 
47
  result
48
 
49
  # transform logit to get probabilities
 
41
  # RoBERTA: [0]: neutral, [1]: toxic
42
  encoding = tokenizer.encode(txt, return_tensors='pt')
43
  result = model(encoding)
44
+
45
  result
46
+ if (result.logits.size(dim=0) >= 2):
47
+ pad = (0, 1)
48
+ result = nn.functional.pad(result, pad, "constant", 0)
49
  result
50
 
51
  # transform logit to get probabilities