X-iZhang commited on
Commit
d61d98e
·
verified ·
1 Parent(s): 02a02fb

Update factual/RaTEScore/scorer.py

Browse files
Files changed (1) hide show
  1. factual/RaTEScore/scorer.py +5 -6
factual/RaTEScore/scorer.py CHANGED
@@ -18,7 +18,7 @@ class RaTEScore:
18
  bert_model="Angelakeke/RaTE-NER-Deberta",
19
  eval_model='FremyCompany/BioLORD-2023-C',
20
  batch_size=1,
21
- use_gpu=False,
22
  visualization_path=None,
23
  affinity_matrix="long",
24
  ):
@@ -38,11 +38,10 @@ class RaTEScore:
38
 
39
  """
40
 
41
- # if use_gpu
42
- if use_gpu:
43
- self.device = torch.device('cuda')
44
- else:
45
- self.device = torch.device('cpu')
46
 
47
  # load the Medical entity recognition module
48
  self.tokenizer = AutoTokenizer.from_pretrained(bert_model)
 
18
  bert_model="Angelakeke/RaTE-NER-Deberta",
19
  eval_model='FremyCompany/BioLORD-2023-C',
20
  batch_size=1,
21
+ use_gpu=None,
22
  visualization_path=None,
23
  affinity_matrix="long",
24
  ):
 
38
 
39
  """
40
 
41
+ # Auto select GPU
42
+ if use_gpu is None:
43
+ use_gpu = torch.cuda.is_available()
44
+ self.device = torch.device("cuda" if use_gpu else "cpu")
 
45
 
46
  # load the Medical entity recognition module
47
  self.tokenizer = AutoTokenizer.from_pretrained(bert_model)