Update README.md
Browse files
README.md
CHANGED
|
@@ -24,16 +24,24 @@ It was trained and evaluated as a baseline with the aspect-normalized [UTCD](htt
|
|
| 24 |
You can use the model like this:
|
| 25 |
|
| 26 |
```python
|
| 27 |
-
from zeroshot_classifier.models import BinaryBertCrossEncoder
|
| 28 |
-
model = BinaryBertCrossEncoder(model_name='claritylab/zero-shot-vanilla-binary-bert')
|
| 29 |
-
|
| 30 |
-
text = "I'd like to have this track onto my Classical Relaxations playlist."
|
| 31 |
-
labels = [
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
]
|
| 35 |
-
query = [[text, lb] for lb in labels]
|
| 36 |
-
logits = model.predict(query, apply_softmax=True)
|
| 37 |
-
print(logits)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
```
|
| 39 |
|
|
|
|
| 24 |
You can use the model like this:
|
| 25 |
|
| 26 |
```python
|
| 27 |
+
>>> from zeroshot_classifier.models import BinaryBertCrossEncoder
|
| 28 |
+
>>> model = BinaryBertCrossEncoder(model_name='claritylab/zero-shot-vanilla-binary-bert')
|
| 29 |
+
|
| 30 |
+
>>> text = "I'd like to have this track onto my Classical Relaxations playlist."
|
| 31 |
+
>>> labels = [
|
| 32 |
+
>>> 'Add To Playlist', 'Book Restaurant', 'Get Weather', 'Play Music', 'Rate Book', 'Search Creative Work',
|
| 33 |
+
>>> 'Search Screening Event'
|
| 34 |
+
>>> ]
|
| 35 |
+
>>> query = [[text, lb] for lb in labels]
|
| 36 |
+
>>> logits = model.predict(query, apply_softmax=True)
|
| 37 |
+
>>> print(logits)
|
| 38 |
+
|
| 39 |
+
[[1.1909954e-04 9.9988091e-01]
|
| 40 |
+
[9.9997509e-01 2.4927122e-05]
|
| 41 |
+
[9.9997497e-01 2.5082643e-05]
|
| 42 |
+
[2.4483365e-04 9.9975520e-01]
|
| 43 |
+
[9.9996781e-01 3.2211588e-05]
|
| 44 |
+
[9.9985993e-01 1.4002046e-04]
|
| 45 |
+
[9.9976152e-01 2.3845369e-04]]
|
| 46 |
```
|
| 47 |
|