ProdicusII
commited on
Commit
•
7edec27
1
Parent(s):
6fc7d66
Update README.md
Browse files
README.md
CHANGED
@@ -24,10 +24,21 @@ tags:
|
|
24 |
|
25 |
## Model description
|
26 |
Model takes as input two strings. String1 is NER label. String1 must be phrase for entity. String2 is short text where String1 is searched for semantically.
|
27 |
-
model outputs list of zeros and ones corresponding to the occurance of
|
28 |
|
29 |
## Example of usage
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
## Code availibility
|
32 |
|
33 |
Code used for training and testing the model is available at https://github.com/br-ai-ns-institute/Zero-ShotNER
|
|
|
24 |
|
25 |
## Model description
|
26 |
Model takes as input two strings. String1 is NER label. String1 must be phrase for entity. String2 is short text where String1 is searched for semantically.
|
27 |
+
model outputs list of zeros and ones corresponding to the occurance of Named Entity and corresponing to the tokens(tokens given by transformer tokenizer) of the Sring2.
|
28 |
|
29 |
## Example of usage
|
30 |
|
31 |
+
from transformers import AutoTokenizer
|
32 |
+
modelname='./' #modelpath
|
33 |
+
tokenizer = AutoTokenizer.from_pretrained(modelname) ## loading the tokenizer of that model
|
34 |
+
string1='Drug'
|
35 |
+
string2='No recent antibiotics or other nephrotoxins, and no symptoms of UTI with benign UA.'
|
36 |
+
encodings = tokenizer(string1,string2, is_split_into_words=False,
|
37 |
+
padding=True, truncation=True, add_special_tokens=True, return_offsets_mapping=False,max_length=512,return_tensors='pt')
|
38 |
+
from transformers import BertForTokenClassification #AutoModelForPreTraining
|
39 |
+
model = BertForTokenClassification.from_pretrained(modelname, num_labels=2)
|
40 |
+
prediction_logits=model(**encodings)
|
41 |
+
|
42 |
## Code availibility
|
43 |
|
44 |
Code used for training and testing the model is available at https://github.com/br-ai-ns-institute/Zero-ShotNER
|