lvwerra HF staff commited on
Commit
b3dd9f7
1 Parent(s): a99cbcd

Update Space (evaluate main: 99ec25a4)

Browse files
Files changed (2) hide show
  1. bertscore.py +7 -2
  2. requirements.txt +1 -1
bertscore.py CHANGED
@@ -160,12 +160,17 @@ class BERTScore(evaluate.Metric):
160
  scorer = functools.partial(scorer, use_fast_tokenizer=use_fast_tokenizer)
161
  elif use_fast_tokenizer:
162
  raise ImportWarning(
163
- "To use a fast tokenizer, the module `bert-score>=0.3.10` is required, and the current version of `bert-score` doesn't match this condition.\n"
 
164
  'You can install it with `pip install "bert-score>=0.3.10"`.'
165
  )
166
 
167
  if model_type is None:
168
- assert lang is not None, "either lang or model_type should be specified"
 
 
 
 
169
  model_type = bert_score.utils.lang2model[lang.lower()]
170
 
171
  if num_layers is None:
 
160
  scorer = functools.partial(scorer, use_fast_tokenizer=use_fast_tokenizer)
161
  elif use_fast_tokenizer:
162
  raise ImportWarning(
163
+ "To use a fast tokenizer, the module `bert-score>=0.3.10` is required, and the current version of "
164
+ "`bert-score` doesn't match this condition.\n"
165
  'You can install it with `pip install "bert-score>=0.3.10"`.'
166
  )
167
 
168
  if model_type is None:
169
+ if lang is None:
170
+ raise ValueError(
171
+ "Either 'lang' (e.g. 'en') or 'model_type' (e.g. 'microsoft/deberta-xlarge-mnli')"
172
+ " must be specified"
173
+ )
174
  model_type = bert_score.utils.lang2model[lang.lower()]
175
 
176
  if num_layers is None:
requirements.txt CHANGED
@@ -1,2 +1,2 @@
1
- git+https://github.com/huggingface/evaluate@283a1f07d6360e960b3ae829f2aeca839ce29839
2
  bert_score
 
1
+ git+https://github.com/huggingface/evaluate@99ec25a4e39c7fdb65ac1165f1a1c0b2d49e26e7
2
  bert_score