Spaces:
Build error
Build error
add versions
Browse files- sescore.py +7 -2
sescore.py
CHANGED
@@ -122,8 +122,13 @@ class SEScore(evaluate.Metric):
|
|
122 |
from huggingface_hub import snapshot_download
|
123 |
# initialize roberta into str2encoder
|
124 |
comet.encoders.str2encoder['RoBERTa'] = robertaEncoder
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
def _compute(self, predictions, references, gpus=None, progress_bar=False):
|
129 |
if gpus is None:
|
|
|
122 |
from huggingface_hub import snapshot_download
|
123 |
# initialize roberta into str2encoder
|
124 |
comet.encoders.str2encoder['RoBERTa'] = robertaEncoder
|
125 |
+
if self.config_name == "default":
|
126 |
+
destination = snapshot_download(repo_id="xu1998hz/sescore_english_mt", revision="main")
|
127 |
+
self.scorer = load_from_checkpoint(f'{destination}/checkpoint/sescore_english_mt.ckpt')
|
128 |
+
else:
|
129 |
+
destination = snapshot_download(repo_id=self.config_name, revision="main")
|
130 |
+
suffix = self.config_name.split('/')[-1]
|
131 |
+
self.scorer = load_from_checkpoint(f'{destination}/checkpoint/{suffix}.ckpt')
|
132 |
|
133 |
def _compute(self, predictions, references, gpus=None, progress_bar=False):
|
134 |
if gpus is None:
|