Wendaxu commited on
Commit
b768da6
·
1 Parent(s): de3c9f7

update upload path

Browse files
Files changed (1) hide show
  1. sescore.py +8 -6
sescore.py CHANGED
@@ -123,14 +123,16 @@ class SEScore(evaluate.Metric):
123
  from comet import load_from_checkpoint
124
  import gdown
125
  import os
 
126
  # initialize roberta into str2encoder
127
  comet.encoders.str2encoder['RoBERTa'] = robertaEncoder
128
- url = "https://drive.google.com/uc?id=1QgMP_Y4QCbvDMTeVacYt0J76OYvwWK9V&export=download&confirm=true"
129
- output = 'sescore_ckpt.gz'
130
- gdown.download(url, output, quiet=False)
131
- cmd = 'tar -xvf sescore_ckpt.gz'
132
- os.system(cmd)
133
- self.scorer = load_from_checkpoint('sescore_ckpt/zh_en/checkpoint/sescore_english.ckpt')
 
134
 
135
  def _compute(self, sources, predictions, references, gpus=None, progress_bar=False):
136
  if gpus is None:
 
123
  from comet import load_from_checkpoint
124
  import gdown
125
  import os
126
+ from huggingface_hub import snapshot_download
127
  # initialize roberta into str2encoder
128
  comet.encoders.str2encoder['RoBERTa'] = robertaEncoder
129
+ # url = "https://drive.google.com/uc?id=1QgMP_Y4QCbvDMTeVacYt0J76OYvwWK9V&export=download&confirm=true"
130
+ # output = 'sescore_ckpt.gz'
131
+ # gdown.download(url, output, quiet=False)
132
+ # cmd = 'tar -xvf sescore_ckpt.gz'
133
+ # os.system(cmd)
134
+ snapshot_download(repo_id="xu1998hz/sescore_english_mt", revision="main")
135
+ self.scorer = load_from_checkpoint('sescore_english_mt/checkpoint/sescore_english.ckpt')
136
 
137
  def _compute(self, sources, predictions, references, gpus=None, progress_bar=False):
138
  if gpus is None: