Update README.md
Browse files
README.md
CHANGED
|
@@ -1,6 +1,3 @@
|
|
| 1 |
-
---
|
| 2 |
-
{}
|
| 3 |
-
---
|
| 4 |
# 🤖 GLMMC: Generalist and Lightweight Model for Multilabel Classification
|
| 5 |
|
| 6 |
GLMMC is a Multilabel Classification Model capable of classifying texts into various predefined entities using a bidirectional transformer encoder (BERT-like). It provides a practical alternative to Large Language Models (LLMs), which, despite their flexibility, are costly and too large for resource-constrained scenarios.
|
|
@@ -10,17 +7,17 @@ GLMMC is a Multilabel Classification Model capable of classifying texts into var
|
|
| 10 |
|
| 11 |
from model import BiEncoderModel
|
| 12 |
|
| 13 |
-
texts = ["A celebrity chef has opened a new restaurant specializing in vegan cuisine.",
|
| 14 |
-
"Doctors are warning about the rise in flu cases this season.",
|
| 15 |
"The United States has announced plans to build a wall on its border with Mexico."]
|
| 16 |
batch_labels = [
|
| 17 |
-
|
| 18 |
["Food", "Business", "Politics"],
|
| 19 |
["Health", "Food", "Public Health"],
|
| 20 |
["Immigration", "Religion", "National Security"]
|
| 21 |
]
|
| 22 |
# Load the model
|
| 23 |
-
model = BiEncoderModel("
|
| 24 |
# Prediction with JSON output
|
| 25 |
predictions = model.forward_predict(texts, batch_labels)
|
| 26 |
print("Predictions:", predictions)
|
|
@@ -31,10 +28,11 @@ print("Predictions:", predictions)
|
|
| 31 |
#### Expected Output
|
| 32 |
|
| 33 |
```
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
{'text': 'Doctors are warning about the rise in flu cases this season.', 'scores': {'Health':
|
| 37 |
-
{'text': 'The United States has announced plans to build a wall on its border with Mexico.', 'scores': {'Immigration':
|
|
|
|
| 38 |
|
| 39 |
```
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# 🤖 GLMMC: Generalist and Lightweight Model for Multilabel Classification
|
| 2 |
|
| 3 |
GLMMC is a Multilabel Classification Model capable of classifying texts into various predefined entities using a bidirectional transformer encoder (BERT-like). It provides a practical alternative to Large Language Models (LLMs), which, despite their flexibility, are costly and too large for resource-constrained scenarios.
|
|
|
|
| 7 |
|
| 8 |
from model import BiEncoderModel
|
| 9 |
|
| 10 |
+
texts = ["A celebrity chef has opened a new restaurant specializing in vegan cuisine.",
|
| 11 |
+
"Doctors are warning about the rise in flu cases this season.",
|
| 12 |
"The United States has announced plans to build a wall on its border with Mexico."]
|
| 13 |
batch_labels = [
|
| 14 |
+
|
| 15 |
["Food", "Business", "Politics"],
|
| 16 |
["Health", "Food", "Public Health"],
|
| 17 |
["Immigration", "Religion", "National Security"]
|
| 18 |
]
|
| 19 |
# Load the model
|
| 20 |
+
model = BiEncoderModel("sabdou/bi-encoder-model", max_num_labels=6)
|
| 21 |
# Prediction with JSON output
|
| 22 |
predictions = model.forward_predict(texts, batch_labels)
|
| 23 |
print("Predictions:", predictions)
|
|
|
|
| 28 |
#### Expected Output
|
| 29 |
|
| 30 |
```
|
| 31 |
+
Predictions: [
|
| 32 |
+
{'text': 'A celebrity chef has opened a new restaurant specializing in vegan cuisine.', 'scores': {'Food': 1.0, 'Business': 1.0, 'Politics': 0.0}},
|
| 33 |
+
{'text': 'Doctors are warning about the rise in flu cases this season.', 'scores': {'Health': 1.0, 'Food': 0.0, 'Public Health': 1.0}},
|
| 34 |
+
{'text': 'The United States has announced plans to build a wall on its border with Mexico.', 'scores': {'Immigration': 1.0, 'Religion': 0.0, 'National Security': 1.0}
|
| 35 |
+
]
|
| 36 |
|
| 37 |
```
|
| 38 |
|