add custom handler and modify pipeline
Browse files
__pycache__/bert_for_sequence_classification.cpython-37.pyc
CHANGED
|
Binary files a/__pycache__/bert_for_sequence_classification.cpython-37.pyc and b/__pycache__/bert_for_sequence_classification.cpython-37.pyc differ
|
|
|
__pycache__/bibert_multitask_classification.cpython-37.pyc
CHANGED
|
Binary files a/__pycache__/bibert_multitask_classification.cpython-37.pyc and b/__pycache__/bibert_multitask_classification.cpython-37.pyc differ
|
|
|
__pycache__/handler.cpython-37.pyc
CHANGED
|
Binary files a/__pycache__/handler.cpython-37.pyc and b/__pycache__/handler.cpython-37.pyc differ
|
|
|
handler.py
CHANGED
|
@@ -6,6 +6,11 @@ from transformers import pipeline
|
|
| 6 |
from transformers.pipelines import PIPELINE_REGISTRY
|
| 7 |
from bibert_multitask_classification import BiBert_MultiTaskPipeline
|
| 8 |
from bert_for_sequence_classification import BertForSequenceClassification
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
@dataclass
|
| 11 |
class Task:
|
|
@@ -41,6 +46,7 @@ class EndpointHandler():
|
|
| 41 |
Return:
|
| 42 |
A :obj:`list` | `dict`: will be serialized and returned
|
| 43 |
"""
|
|
|
|
| 44 |
inputs = data.pop("inputs", data)
|
| 45 |
lang = data.pop("lang", None)
|
| 46 |
|
|
|
|
| 6 |
from transformers.pipelines import PIPELINE_REGISTRY
|
| 7 |
from bibert_multitask_classification import BiBert_MultiTaskPipeline
|
| 8 |
from bert_for_sequence_classification import BertForSequenceClassification
|
| 9 |
+
from transformers.utils import logging
|
| 10 |
+
|
| 11 |
+
logging.set_verbosity_info()
|
| 12 |
+
logger = logging.get_logger("transformers")
|
| 13 |
+
|
| 14 |
|
| 15 |
@dataclass
|
| 16 |
class Task:
|
|
|
|
| 46 |
Return:
|
| 47 |
A :obj:`list` | `dict`: will be serialized and returned
|
| 48 |
"""
|
| 49 |
+
logger.info("INFO")
|
| 50 |
inputs = data.pop("inputs", data)
|
| 51 |
lang = data.pop("lang", None)
|
| 52 |
|