Spaces:
Running
Running
Update interfaces/base_pipeline.py
Browse files
interfaces/base_pipeline.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
from utca.core import RenameAttribute,Flush
|
2 |
from utca.implementation.predictors import TokenSearcherPredictor, TokenSearcherPredictorConfig
|
3 |
from utca.implementation.tasks import TokenSearcherNER, TokenSearcherNERPostprocessor
|
@@ -29,7 +30,7 @@ def generate_pipeline(threshold: float = 0.5):
|
|
29 |
tokenizer = AutoTokenizer.from_pretrained("knowledgator/UTC-DeBERTa-large-v2")
|
30 |
model = AutoModelForTokenClassification.from_pretrained("knowledgator/UTC-DeBERTa-large-v2")
|
31 |
|
32 |
-
transformers_pipeline = pipeline(device="cpu", task="ner", model ="knowledgator/UTC-DeBERTa-small", pipeline_class =TokenClassificationPipeline, aggregation_strategy = "first", batch_size = 12)
|
33 |
|
34 |
if __name__=="__main__":
|
35 |
pipeline = generate_pipeline()
|
|
|
1 |
+
import torch
|
2 |
from utca.core import RenameAttribute,Flush
|
3 |
from utca.implementation.predictors import TokenSearcherPredictor, TokenSearcherPredictorConfig
|
4 |
from utca.implementation.tasks import TokenSearcherNER, TokenSearcherNERPostprocessor
|
|
|
30 |
tokenizer = AutoTokenizer.from_pretrained("knowledgator/UTC-DeBERTa-large-v2")
|
31 |
model = AutoModelForTokenClassification.from_pretrained("knowledgator/UTC-DeBERTa-large-v2")
|
32 |
|
33 |
+
transformers_pipeline = pipeline(device=torch.device("cpu"), task="ner", model ="knowledgator/UTC-DeBERTa-small", pipeline_class =TokenClassificationPipeline, aggregation_strategy = "first", batch_size = 12)
|
34 |
|
35 |
if __name__=="__main__":
|
36 |
pipeline = generate_pipeline()
|