Commit
·
848842c
1
Parent(s):
487946b
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ def predict(text=None) -> dict:
|
|
20 |
token_logits = model(input_ids, attention_mask=attention_mask).logits
|
21 |
mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1]
|
22 |
mask_token_logits = token_logits[0, mask_token_index, :]
|
|
|
23 |
top_5_tokens = torch.topk(mask_token_logits, NUM_CLASSES, dim=1).indices[0].tolist()
|
24 |
score = torch.nn.functional.softmax(mask_token_logits)[0]
|
25 |
top_5_score = torch.topk(score, NUM_CLASSES).values.tolist()
|
|
|
20 |
token_logits = model(input_ids, attention_mask=attention_mask).logits
|
21 |
mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1]
|
22 |
mask_token_logits = token_logits[0, mask_token_index, :]
|
23 |
+
print(mask_token_logits.shape)
|
24 |
top_5_tokens = torch.topk(mask_token_logits, NUM_CLASSES, dim=1).indices[0].tolist()
|
25 |
score = torch.nn.functional.softmax(mask_token_logits)[0]
|
26 |
top_5_score = torch.topk(score, NUM_CLASSES).values.tolist()
|