Update README.md
Browse files
README.md
CHANGED
|
@@ -46,6 +46,7 @@ import torch
|
|
| 46 |
# Load model and tokenizer
|
| 47 |
model = AutoModelForTokenClassification.from_pretrained("oleksiydolgykh/event-message-detector")
|
| 48 |
tokenizer = AutoTokenizer.from_pretrained("oleksiydolgykh/event-message-detector")
|
|
|
|
| 49 |
|
| 50 |
# Example message
|
| 51 |
message = "[MESSAGE] [user1]: Let's have a meeting tomorrow at 10 AM."
|
|
@@ -59,4 +60,4 @@ with torch.no_grad():
|
|
| 59 |
|
| 60 |
# Process outputs
|
| 61 |
logits = outputs.logits
|
| 62 |
-
predictions = torch.
|
|
|
|
| 46 |
# Load model and tokenizer
|
| 47 |
model = AutoModelForTokenClassification.from_pretrained("oleksiydolgykh/event-message-detector")
|
| 48 |
tokenizer = AutoTokenizer.from_pretrained("oleksiydolgykh/event-message-detector")
|
| 49 |
+
tokenizer.truncation_side = "left"
|
| 50 |
|
| 51 |
# Example message
|
| 52 |
message = "[MESSAGE] [user1]: Let's have a meeting tomorrow at 10 AM."
|
|
|
|
| 60 |
|
| 61 |
# Process outputs
|
| 62 |
logits = outputs.logits
|
| 63 |
+
predictions = torch.softmax(logits, dim=-1)[:, 1].mean()
|