Update factual/RaTEScore/scorer.py
Browse files
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=
|
| 22 |
visualization_path=None,
|
| 23 |
affinity_matrix="long",
|
| 24 |
):
|
|
@@ -38,11 +38,10 @@ class RaTEScore:
|
|
| 38 |
|
| 39 |
"""
|
| 40 |
|
| 41 |
-
#
|
| 42 |
-
if use_gpu:
|
| 43 |
-
|
| 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)
|