Instructions to use raynardj/ner-disease-ncbi-bionlp-bc5cdr-pubmed with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use raynardj/ner-disease-ncbi-bionlp-bc5cdr-pubmed with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="raynardj/ner-disease-ncbi-bionlp-bc5cdr-pubmed")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("raynardj/ner-disease-ncbi-bionlp-bc5cdr-pubmed") model = AutoModelForTokenClassification.from_pretrained("raynardj/ner-disease-ncbi-bionlp-bc5cdr-pubmed") - Notebooks
- Google Colab
- Kaggle
Changed keyerror. Replaced index with end and entity with entity_group
#1
by Shashank14 - opened
README.md
CHANGED
|
@@ -47,12 +47,12 @@ def clean_output(outputs):
|
|
| 47 |
last_idx = 0
|
| 48 |
# make to sub group by position
|
| 49 |
for output in outputs:
|
| 50 |
-
if output["
|
| 51 |
current.append(output)
|
| 52 |
else:
|
| 53 |
results.append(current)
|
| 54 |
current = [output, ]
|
| 55 |
-
last_idx = output["
|
| 56 |
if len(current)>0:
|
| 57 |
results.append(current)
|
| 58 |
|
|
@@ -72,7 +72,7 @@ def clean_output(outputs):
|
|
| 72 |
word=new_str,
|
| 73 |
start = min(starts),
|
| 74 |
end = max(ends),
|
| 75 |
-
entity = c[0]['
|
| 76 |
))
|
| 77 |
return strings
|
| 78 |
def entity_table(pipeline, **pipeline_kw):
|
|
|
|
| 47 |
last_idx = 0
|
| 48 |
# make to sub group by position
|
| 49 |
for output in outputs:
|
| 50 |
+
if output["end"]-1==last_idx:
|
| 51 |
current.append(output)
|
| 52 |
else:
|
| 53 |
results.append(current)
|
| 54 |
current = [output, ]
|
| 55 |
+
last_idx = output["end"]
|
| 56 |
if len(current)>0:
|
| 57 |
results.append(current)
|
| 58 |
|
|
|
|
| 72 |
word=new_str,
|
| 73 |
start = min(starts),
|
| 74 |
end = max(ends),
|
| 75 |
+
entity = c[0]['entity_group']
|
| 76 |
))
|
| 77 |
return strings
|
| 78 |
def entity_table(pipeline, **pipeline_kw):
|