Commit
·
e7ed86c
1
Parent(s):
803a0f9
Adding model details.
Browse files
README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
Number of Epochs = 5 <br>
|
| 6 |
+
Dataset Size = 5.5 k samples [train/validation] <br>
|
| 7 |
+
Number of labels used = 2 <br>
|
| 8 |
+
Thresholding = True<br>
|
| 9 |
+
Thresholding value = 0.7<br>
|
| 10 |
+
|
| 11 |
+
Below is the function to aplly thresholding to output logits.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
```python
|
| 15 |
+
def get_prediction(text):
|
| 16 |
+
encoding = new_tokenizer(text, return_tensors="pt", padding="max_length", truncation=True, max_length=128)
|
| 17 |
+
encoding = {k: v.to(trainer.model.device) for k,v in encoding.items()}
|
| 18 |
+
|
| 19 |
+
outputs = new_model(**encoding)
|
| 20 |
+
|
| 21 |
+
logits = outputs.logits
|
| 22 |
+
|
| 23 |
+
sigmoid = torch.nn.Sigmoid()
|
| 24 |
+
probs = probs.detach().numpy()
|
| 25 |
+
label = np.argmax(probs, axis=-1)
|
| 26 |
+
if label == 1:
|
| 27 |
+
if probs[1] > 0.7:
|
| 28 |
+
return 1
|
| 29 |
+
else:
|
| 30 |
+
return 0
|
| 31 |
+
else:
|
| 32 |
+
return 0
|
| 33 |
+
```
|