File size: 1,065 Bytes
effc10e 4e5f4b6 effc10e 4e5f4b6 1f9b5e3 27979bb 8d529a8 27979bb d2dd34b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
---
language:
- en
license: apache-2.0
base_model:
- FacebookAI/roberta-base
pipeline_tag: token-classification
---
## Usage
* Importing the libraries and loading the models and the pipeline
```python
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
model_id = "gauneg/roberta-base-absa-ate-sentiment"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForTokenClassification.from_pretrained(model_id)
ate_sent_pipeline = pipeline(task='ner',
aggregation_strategy='simple',
tokenizer=tokenizer,
model=model)
```
* Using the pipeline object:
```python
text_input = "Been here a few times and food has always been good but service really suffers when it gets crowded."
ate_sent_pipeline(text_input)
```
* pipeline output:
```bash
[{'entity_group': 'pos',
'score': 0.8447307,
'word': ' food',
'start': 26,
'end': 30},
{'entity_group': 'neg',
'score': 0.81927896,
'word': ' service',
'start': 56,
'end': 63}]
```
|