Instructions to use MDDDDR/dmis_lab_biobert_v1.1_NER with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MDDDDR/dmis_lab_biobert_v1.1_NER with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="MDDDDR/dmis_lab_biobert_v1.1_NER")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("MDDDDR/dmis_lab_biobert_v1.1_NER") model = AutoModelForTokenClassification.from_pretrained("MDDDDR/dmis_lab_biobert_v1.1_NER", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -43,13 +43,40 @@ tokenized = tokenizer(text, return_tensors='pt')
|
|
| 43 |
output = model(**tokenized)
|
| 44 |
|
| 45 |
# result
|
| 46 |
-
|
| 47 |
|
| 48 |
-
# check
|
| 49 |
-
for txt, pred in zip(tokenizer.tokenize(text),
|
| 50 |
print("{}\t{}".format(id2tag[pred], txt))
|
| 51 |
# B_MT mental
|
| 52 |
-
# B_MT disorder
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
```
|
| 54 |
|
| 55 |
## Framework versions
|
|
|
|
| 43 |
output = model(**tokenized)
|
| 44 |
|
| 45 |
# result
|
| 46 |
+
preds = np.argmax(output[0].cpu().detach().numpy(), axis=2)[0][1:-1]
|
| 47 |
|
| 48 |
+
# check preds
|
| 49 |
+
for txt, pred in zip(tokenizer.tokenize(text), preds):
|
| 50 |
print("{}\t{}".format(id2tag[pred], txt))
|
| 51 |
# B_MT mental
|
| 52 |
+
# B_MT disorder
|
| 53 |
+
# O can
|
| 54 |
+
# O also
|
| 55 |
+
# O contribute
|
| 56 |
+
# O to
|
| 57 |
+
# O the
|
| 58 |
+
# B_MT development
|
| 59 |
+
# O of
|
| 60 |
+
# B_MT diabetes
|
| 61 |
+
# O through
|
| 62 |
+
# O various
|
| 63 |
+
# B_MT mechanism
|
| 64 |
+
# O including
|
| 65 |
+
# O increased
|
| 66 |
+
# B_MT stress
|
| 67 |
+
# O ,
|
| 68 |
+
# O poor
|
| 69 |
+
# B_MT self
|
| 70 |
+
# B_MT care
|
| 71 |
+
# B_MT behavior
|
| 72 |
+
# O ,
|
| 73 |
+
# O and
|
| 74 |
+
# B_MT adverse
|
| 75 |
+
# I_MT effect
|
| 76 |
+
# O on
|
| 77 |
+
# B_MT glucose
|
| 78 |
+
# B_MT metabolism
|
| 79 |
+
# O .
|
| 80 |
```
|
| 81 |
|
| 82 |
## Framework versions
|