sitingGZ commited on
Commit
9111a98
1 Parent(s): 9d20d9c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -24
README.md CHANGED
@@ -22,27 +22,27 @@ language:
22
  - **Demo (Coming soon)
23
 
24
  ## Uses
25
- import sys
26
- sys.path.append('modules')
27
-
28
- import torch
29
- from transformers import AutoConfig, AutoTokenizer, AutoModelForMaskedLM, EncoderDecoderConfig
30
- from BERT2span_semantic_disam import BERT2span
31
- from helpers import load_config, set_seed
32
- from inference import final_label_results_rescaled
33
-
34
- base_name = "bert-base-german-cased"
35
- configs = load_config('configs/step3_gpu_span_semantic_group.yaml')
36
- tokenizer = AutoTokenizer.from_pretrained(base_name)
37
- bertMLM = AutoModelForMaskedLM.from_pretrained(base_name)
38
- bert_sner = BERT2span(configs, bertMLM, tokenizer)
39
-
40
- checkpoint_path = "checkpoints/german_bert_ex4cds_500_semantic_term.ckpt"
41
- state_dict = torch.load(checkpoint_path, map_location=torch.device('cpu'))
42
- bert_sner.load_state_dict(state_dict)
43
- bert_sner.eval()
44
-
45
- suggested_terms = {'Condition': 'Zeichen oder Symptom',
46
  'DiagLab': 'Diagnostisch und Laborverfahren',
47
  'LabValues': 'Klinisches Attribut',
48
  'HealthState': 'Gesunder Zustand',
@@ -51,9 +51,9 @@ language:
51
  'Process': 'Physiologische Funktion',
52
  'TimeInfo': 'Zeitliches Konzept'}
53
 
54
- words = "Aktuell Infekt mit Nachweis von E Coli und Pseudomonas im TBS- CRP 99mg/dl".split()
55
- words_list = [words]
56
- heatmaps, ner_results = final_label_results_rescaled(words_list, tokenizer, berst_sner, suggested_terms, threshold=0.5)
57
 
58
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
59
 
 
22
  - **Demo (Coming soon)
23
 
24
  ## Uses
25
+ import sys
26
+ sys.path.append('modules')
27
+
28
+ import torch
29
+ from transformers import AutoConfig, AutoTokenizer, AutoModelForMaskedLM, EncoderDecoderConfig
30
+ from BERT2span_semantic_disam import BERT2span
31
+ from helpers import load_config, set_seed
32
+ from inference import final_label_results_rescaled
33
+
34
+ base_name = "bert-base-german-cased"
35
+ configs = load_config('configs/step3_gpu_span_semantic_group.yaml')
36
+ tokenizer = AutoTokenizer.from_pretrained(base_name)
37
+ bertMLM = AutoModelForMaskedLM.from_pretrained(base_name)
38
+ bert_sner = BERT2span(configs, bertMLM, tokenizer)
39
+
40
+ checkpoint_path = "checkpoints/german_bert_ex4cds_500_semantic_term.ckpt"
41
+ state_dict = torch.load(checkpoint_path, map_location=torch.device('cpu'))
42
+ bert_sner.load_state_dict(state_dict)
43
+ bert_sner.eval()
44
+
45
+ suggested_terms = {'Condition': 'Zeichen oder Symptom',
46
  'DiagLab': 'Diagnostisch und Laborverfahren',
47
  'LabValues': 'Klinisches Attribut',
48
  'HealthState': 'Gesunder Zustand',
 
51
  'Process': 'Physiologische Funktion',
52
  'TimeInfo': 'Zeitliches Konzept'}
53
 
54
+ words = "Aktuell Infekt mit Nachweis von E Coli und Pseudomonas im TBS- CRP 99mg/dl".split()
55
+ words_list = [words]
56
+ heatmaps, ner_results = final_label_results_rescaled(words_list, tokenizer, berst_sner, suggested_terms, threshold=0.5)
57
 
58
  <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
59