Update README.md
Browse files
README.md
CHANGED
@@ -39,20 +39,17 @@ This model classifies input tokens into one of five classes:
|
|
39 |
To get started using this model for inference, simply set up an NER `pipeline` like below:
|
40 |
|
41 |
```python
|
42 |
-
|
43 |
from transformers import (AutoModelForTokenClassification,
|
44 |
AutoTokenizer,
|
45 |
pipeline,
|
46 |
)
|
47 |
|
48 |
model_checkpoint = "jsylee/scibert_scivocab_uncased-finetuned-ner"
|
49 |
-
|
50 |
-
model = AutoModelForTokenClassification.from_pretrained(model_checkpoint,
|
51 |
-
num_labels=5,
|
52 |
id2label={0: 'O', 1: 'B-DRUG', 2: 'I-DRUG', 3: 'B-AE', 4: 'I-AE'}
|
53 |
)
|
54 |
-
|
55 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
|
|
56 |
model_pipeline = pipeline(task="ner", model=model, tokenizer=tokenizer)
|
57 |
|
58 |
print( model_pipeline ("Abortion, miscarriage or uterine hemorrhage associated with misoprostol (Cytotec), a labor-inducing drug."))
|
|
|
39 |
To get started using this model for inference, simply set up an NER `pipeline` like below:
|
40 |
|
41 |
```python
|
|
|
42 |
from transformers import (AutoModelForTokenClassification,
|
43 |
AutoTokenizer,
|
44 |
pipeline,
|
45 |
)
|
46 |
|
47 |
model_checkpoint = "jsylee/scibert_scivocab_uncased-finetuned-ner"
|
48 |
+
model = AutoModelForTokenClassification.from_pretrained(model_checkpoint, num_labels=5,
|
|
|
|
|
49 |
id2label={0: 'O', 1: 'B-DRUG', 2: 'I-DRUG', 3: 'B-AE', 4: 'I-AE'}
|
50 |
)
|
|
|
51 |
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
52 |
+
|
53 |
model_pipeline = pipeline(task="ner", model=model, tokenizer=tokenizer)
|
54 |
|
55 |
print( model_pipeline ("Abortion, miscarriage or uterine hemorrhage associated with misoprostol (Cytotec), a labor-inducing drug."))
|