helpmefindaname commited on
Commit
473d731
1 Parent(s): 7c02f50

create model

Browse files
Files changed (2) hide show
  1. README.md +51 -0
  2. pytorch_model.bin +3 -0
README.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - flair
4
+ - entity-mention-linker
5
+ ---
6
+
7
+ ## biobert-bc2gn-gene
8
+
9
+ Biomedical Entity Mention Linking for gene
10
+
11
+ ### Demo: How to use in Flair
12
+
13
+ Requires:
14
+ - **[Flair](https://github.com/flairNLP/flair/)>=0.14.0** (`pip install flair` or `pip install git+https://github.com/flairNLP/flair.git`)
15
+
16
+
17
+ ```python
18
+ from flair.data import Sentence
19
+ from flair.models import Classifier, EntityMentionLinker
20
+
21
+ sentence = Sentence("Behavioral abnormalities in the Fmr1 KO2 Mouse Model of Fragile X Syndrome")
22
+
23
+ # load hunflair to detect the entity mentions we want to link.
24
+ tagger = Classifier.load("hunflair")
25
+ tagger.predict(sentence)
26
+
27
+ # load the linker and dictionary
28
+ linker = EntityMentionLinker.load("helpmefindaname/flair-eml-biobert-bc2gn-gene")
29
+ dictionary = linker.dictionary
30
+
31
+ # find then candidates for the mentions
32
+ linker.predict(sentence)
33
+
34
+ # print the results for each entity mention:
35
+ for span in sentence.get_spans(linker.entity_label_type):
36
+ print(f"Span: {span.text}")
37
+ for candidate_label in span.get_labels(linker.label_type):
38
+ candidate = dictionary[candidate_label.value]
39
+ print(f"Candidate: {candidate.concept_name}")
40
+ ```
41
+
42
+
43
+ As an alternative to downloading the already precomputed model (much storage). You can also build the model
44
+ and compute the embeddings for the dataset using:
45
+ ```python
46
+ linker = EntityMentionLinker.build("dmis-lab/biosyn-biobert-bc2gn", "gene", dictionary_name_or_path="ncbi-gene", hybrid_search=False, entity_type="gene-eml")
47
+ ```
48
+ This will reduce the download requirements, at the cost of computation.
49
+
50
+ This EntityMentionLinker uses [https://huggingface.co/dmis-lab/biosyn-biobert-bc2gn](dmis-lab/biosyn-biobert-bc2gn) as embeddings for linking mentions to candidates.
51
+
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d4685b551df0d60c87636fba150247574c25a799b83f294fc51cf4656d06405
3
+ size 2231399371