From 781220acab7a142b084e54aacca05dcaea231621 Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Mon, 8 Feb 2021 12:41:52 -0800 Subject: [PATCH] transition to new tests dir (#10080) --- examples/{seq2seq => tests/deepspeed}/ds_config.json | 0 examples/{seq2seq => tests/deepspeed}/test_deepspeed.py | 9 +++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) rename examples/{seq2seq => tests/deepspeed}/ds_config.json (100%) rename examples/{seq2seq => tests/deepspeed}/test_deepspeed.py (96%) diff --git a/examples/seq2seq/ds_config.json b/examples/tests/deepspeed/ds_config.json similarity index 100% rename from examples/seq2seq/ds_config.json rename to examples/tests/deepspeed/ds_config.json diff --git a/examples/seq2seq/test_deepspeed.py b/examples/tests/deepspeed/test_deepspeed.py similarity index 96% rename from examples/seq2seq/test_deepspeed.py rename to examples/tests/deepspeed/test_deepspeed.py index 1955568ff3..f802583139 100644 --- a/examples/seq2seq/test_deepspeed.py +++ b/examples/tests/deepspeed/test_deepspeed.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json import os import unittest @@ -19,13 +20,17 @@ from transformers.integrations import is_deepspeed_available from transformers.testing_utils import TestCasePlus, execute_subprocess_async, require_torch_multi_gpu from transformers.trainer_callback import TrainerState from transformers.trainer_utils import set_seed -from utils import load_json set_seed(42) MBART_TINY = "sshleifer/tiny-mbart" +def load_json(path): + with open(path) as f: + return json.load(f) + + # a candidate for testing_utils def require_deepspeed(test_case): """ @@ -122,7 +127,7 @@ class TestDeepSpeed(TestCasePlus): ds_args = f"--deepspeed {self.test_file_dir_str}/ds_config.json".split() distributed_args = f""" - {self.test_file_dir}/finetune_trainer.py + {self.test_file_dir}/../../seq2seq/finetune_trainer.py """.split() cmd = ["deepspeed"] + distributed_args + args + ds_args # keep for quick debug