Skip to content

Commit 8fd64d2

Browse files
authored
Fix parity tests ci (#696)
* fix ci * update to 3.9 * style * fix ci
1 parent eae4d42 commit 8fd64d2

5 files changed

Lines changed: 18 additions & 17 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up Python
2323
uses: actions/setup-python@v4
2424
with:
25-
python-version: "3.8"
25+
python-version: "3.9"
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
@@ -45,10 +45,10 @@ jobs:
4545
- uses: actions/checkout@v3
4646
with:
4747
fetch-depth: 0
48-
- name: Set up Python 3.8
48+
- name: Set up Python 3.9
4949
uses: actions/setup-python@v4
5050
with:
51-
python-version: "3.8"
51+
python-version: "3.9"
5252
- name: Upgrade pip
5353
run: python -m pip install --upgrade pip
5454
- name: Install dependencies

metrics/mse/mse.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"""MSE - Mean Squared Error Metric"""
1515

1616
import datasets
17-
from sklearn.metrics import mean_squared_error
17+
from sklearn.metrics import mean_squared_error, root_mean_squared_error
1818

1919
import evaluate
2020

@@ -112,8 +112,10 @@ def _get_feature_types(self):
112112

113113
def _compute(self, predictions, references, sample_weight=None, multioutput="uniform_average", squared=True):
114114

115-
mse = mean_squared_error(
116-
references, predictions, sample_weight=sample_weight, multioutput=multioutput, squared=squared
115+
mse = (
116+
mean_squared_error(references, predictions, sample_weight=sample_weight, multioutput=multioutput)
117+
if squared
118+
else root_mean_squared_error(references, predictions, sample_weight=sample_weight, multioutput=multioutput)
117119
)
118120

119121
return {"mse": mse}

metrics/rl_reliability/rl_reliability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
>>> import numpy as np
7474
>>> rl_reliability = evaluate.load("rl_reliability", "online")
7575
>>> results = rl_reliability.compute(
76-
... timesteps=[np.linspace(0, 2000000, 1000)],
76+
... timesteps=[np.linspace(0, 2000000, 1000, dtype=np.int64())],
7777
... rewards=[np.linspace(0, 100, 1000)]
7878
... )
7979
>>> print(results["LowerCVaROnRaw"].round(4))

src/evaluate/utils/logging.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ def get_lock(self):
218218

219219
def is_progress_bar_enabled() -> bool:
220220
"""Return a boolean indicating whether tqdm progress bars are enabled."""
221-
global _tqdm_active
222221
return bool(_tqdm_active)
223222

224223

tests/test_trainer_evaluator_parity.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_text_classification_parity(self):
5959
) as f:
6060
transformers_results = json.load(f)
6161

62-
eval_dataset = load_dataset("glue", "sst2", split="validation[:80]")
62+
eval_dataset = load_dataset("nyu-mll/glue", "sst2", split="validation[:80]")
6363

6464
pipe = pipeline(task="text-classification", model=model_name, tokenizer=model_name)
6565

@@ -104,7 +104,7 @@ def test_text_classification_parity_two_columns(self):
104104
) as f:
105105
transformers_results = json.load(f)
106106

107-
eval_dataset = load_dataset("glue", "mnli", split=f"validation_matched[:{max_eval_samples}]")
107+
eval_dataset = load_dataset("nyu-mll/glue", "mnli", split=f"validation_matched[:{max_eval_samples}]")
108108

109109
pipe = pipeline(task="text-classification", model=model_name, tokenizer=model_name, max_length=256)
110110

@@ -124,7 +124,7 @@ def test_text_classification_parity_two_columns(self):
124124
def test_image_classification_parity(self):
125125
# we can not compare to the Pytorch transformers example, that uses custom preprocessing on the images
126126
model_name = "douwekiela/resnet-18-finetuned-dogfood"
127-
dataset_name = "beans"
127+
dataset_name = "AI-Lab-Makerere/beans"
128128
max_eval_samples = 120
129129

130130
raw_dataset = load_dataset(dataset_name, split="validation")
@@ -193,7 +193,7 @@ def test_question_answering_parity(self):
193193
subprocess.run(
194194
f"python examples/pytorch/question-answering/run_qa.py"
195195
f" --model_name_or_path {model_name_v1}"
196-
f" --dataset_name squad"
196+
f" --dataset_name rajpurkar/squad"
197197
f" --do_eval"
198198
f" --output_dir {os.path.join(self.dir_path, 'questionanswering_squad_transformers')}"
199199
f" --max_eval_samples 100"
@@ -207,7 +207,7 @@ def test_question_answering_parity(self):
207207
) as f:
208208
transformers_results = json.load(f)
209209

210-
eval_dataset = load_dataset("squad", split="validation[:100]")
210+
eval_dataset = load_dataset("rajpurkar/squad", split="validation[:100]")
211211

212212
pipe = pipeline(
213213
task="question-answering",
@@ -232,7 +232,7 @@ def test_question_answering_parity(self):
232232
subprocess.run(
233233
f"python examples/pytorch/question-answering/run_qa.py"
234234
f" --model_name_or_path {model_name_v2}"
235-
f" --dataset_name squad_v2"
235+
f" --dataset_name rajpurkar/squad_v2"
236236
f" --version_2_with_negative"
237237
f" --do_eval"
238238
f" --output_dir {os.path.join(self.dir_path, 'questionanswering_squadv2_transformers')}"
@@ -247,7 +247,7 @@ def test_question_answering_parity(self):
247247
) as f:
248248
transformers_results = json.load(f)
249249

250-
eval_dataset = load_dataset("squad_v2", split="validation[:100]")
250+
eval_dataset = load_dataset("rajpurkar/squad_v2", split="validation[:100]")
251251

252252
pipe = pipeline(
253253
task="question-answering",
@@ -282,7 +282,7 @@ def test_token_classification_parity(self):
282282
subprocess.run(
283283
f"python examples/pytorch/token-classification/run_ner.py"
284284
f" --model_name_or_path {model_name}"
285-
f" --dataset_name conll2003"
285+
f" --dataset_name areias/conll2003-generative"
286286
f" --do_eval"
287287
f" --output_dir {os.path.join(self.dir_path, 'tokenclassification_conll2003_transformers')}"
288288
f" --max_eval_samples {n_samples}",
@@ -295,7 +295,7 @@ def test_token_classification_parity(self):
295295
) as f:
296296
transformers_results = json.load(f)
297297

298-
eval_dataset = load_dataset("conll2003", split=f"validation[:{n_samples}]")
298+
eval_dataset = load_dataset("areias/conll2003-generative", split=f"validation[:{n_samples}]")
299299

300300
pipe = pipeline(task="token-classification", model=model_name)
301301

0 commit comments

Comments
 (0)