Unverified Commit 79815090 authored by Nathan Raw's avatar Nathan Raw Committed by GitHub
Browse files

Fix img classification tests (#13456)

*  Update image-classification example's tests

* 🔥 remove cats_and_dogs test samples

* 💄 fix flake8
parent 92d4ef9a
...@@ -19,7 +19,6 @@ import json ...@@ -19,7 +19,6 @@ import json
import logging import logging
import os import os
import sys import sys
from unittest.case import skip
from unittest.mock import patch from unittest.mock import patch
import torch import torch
...@@ -344,7 +343,6 @@ class ExamplesTests(TestCasePlus): ...@@ -344,7 +343,6 @@ class ExamplesTests(TestCasePlus):
result = get_results(tmp_dir) result = get_results(tmp_dir)
self.assertGreaterEqual(result["eval_bleu"], 30) self.assertGreaterEqual(result["eval_bleu"], 30)
@skip("The test is failing as accuracy is 0, re-enable when fixed.")
def test_run_image_classification(self): def test_run_image_classification(self):
stream_handler = logging.StreamHandler(sys.stdout) stream_handler = logging.StreamHandler(sys.stdout)
logger.addHandler(stream_handler) logger.addHandler(stream_handler)
...@@ -354,19 +352,19 @@ class ExamplesTests(TestCasePlus): ...@@ -354,19 +352,19 @@ class ExamplesTests(TestCasePlus):
run_image_classification.py run_image_classification.py
--output_dir {tmp_dir} --output_dir {tmp_dir}
--model_name_or_path google/vit-base-patch16-224-in21k --model_name_or_path google/vit-base-patch16-224-in21k
--train_dir tests/fixtures/tests_samples/cats_and_dogs/ --dataset_name hf-internal-testing/cats_vs_dogs_sample
--do_train --do_train
--do_eval --do_eval
--learning_rate 2e-5 --learning_rate 1e-4
--per_device_train_batch_size 2 --per_device_train_batch_size 2
--per_device_eval_batch_size 1 --per_device_eval_batch_size 1
--remove_unused_columns False --remove_unused_columns False
--overwrite_output_dir True --overwrite_output_dir True
--dataloader_num_workers 16 --dataloader_num_workers 16
--metric_for_best_model accuracy --metric_for_best_model accuracy
--max_steps 30 --max_steps 10
--train_val_split 0.1 --train_val_split 0.1
--seed 7 --seed 42
""".split() """.split()
if is_cuda_and_apex_available(): if is_cuda_and_apex_available():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment