Text Classification
Transformers
PyTorch
TensorBoard
bert
Generated from Trainer
text-embeddings-inference
Instructions to use HCKLab/BiBert-MultiTask-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HCKLab/BiBert-MultiTask-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="HCKLab/BiBert-MultiTask-2")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("HCKLab/BiBert-MultiTask-2") model = AutoModelForSequenceClassification.from_pretrained("HCKLab/BiBert-MultiTask-2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
add custom handler and modify pipeline
Browse files- handler.py +2 -4
handler.py
CHANGED
|
@@ -44,10 +44,8 @@ class EndpointHandler():
|
|
| 44 |
Return:
|
| 45 |
A :obj:`list` | `dict`: will be serialized and returned
|
| 46 |
"""
|
| 47 |
-
inputs = data.pop("
|
| 48 |
-
lang = data.pop("lang",
|
| 49 |
-
if isinstance(inputs, str):
|
| 50 |
-
inputs = [inputs]
|
| 51 |
|
| 52 |
prediction_p = self.classifier_p(inputs)
|
| 53 |
label = prediction_p[0]['label']
|
|
|
|
| 44 |
Return:
|
| 45 |
A :obj:`list` | `dict`: will be serialized and returned
|
| 46 |
"""
|
| 47 |
+
inputs = data.pop("inputs", data)
|
| 48 |
+
lang = data.pop("lang", None)
|
|
|
|
|
|
|
| 49 |
|
| 50 |
prediction_p = self.classifier_p(inputs)
|
| 51 |
label = prediction_p[0]['label']
|