From a157dfd93db63260dc41fbcc6cfdf9591780f9ce Mon Sep 17 00:00:00 2001 From: Sara Adkins Date: Wed, 8 May 2024 11:26:30 -0400 Subject: [PATCH] Fixing GHA Hangs (#2265) * test commit * update runners * move pytest to transformers * update import * fix pathing * don't automatically ifer reporters * remove clearml * my attempt to unclot GHA * update model for commit tests * fix export test * can add back in clearml I think * quality * oops! * remove clearml support * PR comments * QUALITY * int tests --------- Co-authored-by: dbogunowicz <97082108+dbogunowicz@users.noreply.github.com> Co-authored-by: dbogunowicz --- setup.py | 1 - src/sparseml/transformers/finetune/text_generation.py | 4 ++++ tests/integrations/transformers/args.py | 6 ------ .../transformers/test_generative_transformers.py | 10 ++++++---- .../oneshot/oneshot_configs/tiny_stories_conf2.yaml | 6 ------ .../oneshot/oneshot_configs/tiny_stories_conf3.yaml | 7 ------- .../oneshot/oneshot_configs/tiny_stories_conf5.yaml | 6 ------ .../oneshot/oneshot_configs/tiny_stories_conf6.yaml | 6 ------ tests/sparseml/pytorch/utils/test_logger.py | 6 +++--- .../{pytorch => transformers}/oneshot/__init__.py | 0 .../oneshot/dataset_processing.py | 0 .../oneshot/oneshot_configs/recipes/recipe.yaml | 0 .../oneshot/oneshot_configs/tiny_stories_conf1.yaml | 2 +- .../oneshot/oneshot_configs/tiny_stories_conf2.yaml | 6 ++++++ .../oneshot/oneshot_configs/tiny_stories_conf3.yaml | 7 +++++++ .../oneshot/oneshot_configs/tiny_stories_conf4.yaml | 2 +- .../oneshot/oneshot_configs/tiny_stories_conf5.yaml | 6 ++++++ .../oneshot/oneshot_configs/tiny_stories_conf6.yaml | 6 ++++++ .../oneshot/test_api_inputs.py | 4 ++-- .../{pytorch => transformers}/oneshot/test_cli.py | 2 +- 20 files changed, 43 insertions(+), 44 deletions(-) delete mode 100644 tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf2.yaml delete mode 100644 tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf3.yaml delete mode 100644 tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf5.yaml delete mode 100644 tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf6.yaml rename tests/sparseml/{pytorch => transformers}/oneshot/__init__.py (100%) rename tests/sparseml/{pytorch => transformers}/oneshot/dataset_processing.py (100%) rename tests/sparseml/{pytorch => transformers}/oneshot/oneshot_configs/recipes/recipe.yaml (100%) rename tests/sparseml/{pytorch => transformers}/oneshot/oneshot_configs/tiny_stories_conf1.yaml (84%) create mode 100644 tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf2.yaml create mode 100644 tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf3.yaml rename tests/sparseml/{pytorch => transformers}/oneshot/oneshot_configs/tiny_stories_conf4.yaml (85%) create mode 100644 tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf5.yaml create mode 100644 tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf6.yaml rename tests/sparseml/{pytorch => transformers}/oneshot/test_api_inputs.py (94%) rename tests/sparseml/{pytorch => transformers}/oneshot/test_cli.py (96%) diff --git a/setup.py b/setup.py index 281aa1d9ded..dff04c25c06 100644 --- a/setup.py +++ b/setup.py @@ -120,7 +120,6 @@ "tensorboardX>=1.0", "evaluate>=0.4.1", "parameterized", - "clearml==1.14.4", ] _docs_deps = [ diff --git a/src/sparseml/transformers/finetune/text_generation.py b/src/sparseml/transformers/finetune/text_generation.py index fbc1bcb146c..0ade9b9974a 100644 --- a/src/sparseml/transformers/finetune/text_generation.py +++ b/src/sparseml/transformers/finetune/text_generation.py @@ -85,8 +85,12 @@ def apply(**kwargs): """ CLI entrypoint for any of training, eval, predict or oneshot """ + report_to = kwargs.get("report_to", None) model_args, data_args, training_args = parse_args(**kwargs) training_args.run_stages = True + if report_to is None: # user didn't specify any reporters + # get rid of the reporters inferred from hugging face + training_args.report_to = [] main(model_args, data_args, training_args) diff --git a/tests/integrations/transformers/args.py b/tests/integrations/transformers/args.py index 54833ded5e2..20f2e70afdf 100644 --- a/tests/integrations/transformers/args.py +++ b/tests/integrations/transformers/args.py @@ -507,12 +507,6 @@ class _TransformersTrainArgs(BaseModel): push_to_hub_token: str = Field( default=None, description="The token to use to push to the Model Hub." ) - n_gpu_: int = Field(init=False, repr=False, default=-1) - mp_parameters: Optional[str] = Field( - default=None, - description="Used by the SageMaker launcher to send mp-specific args. " - "Ignored in Trainer", - ) class QuestionAnsweringArgs(_TransformersTrainArgs): diff --git a/tests/sparseml/export/transformers/test_generative_transformers.py b/tests/sparseml/export/transformers/test_generative_transformers.py index 7f5f7d1c844..1a9af341cb9 100644 --- a/tests/sparseml/export/transformers/test_generative_transformers.py +++ b/tests/sparseml/export/transformers/test_generative_transformers.py @@ -42,13 +42,13 @@ def setup(self, tmp_path, stub, task): shutil.rmtree(tmp_path) - def test_export_initialized_model_no_source_path(self, setup): + def test_export_initialized_model_no_source_path(self, tmp_path, stub, task): # export the transformer model, that is being passed to the # `export` API directly as an object - source_path, target_path, task = setup + target_path = tmp_path / "target" export( - model=SparseAutoModelForCausalLM.from_pretrained(source_path), - tokenizer=SparseAutoTokenizer.from_pretrained(source_path), + model=SparseAutoModelForCausalLM.from_pretrained(stub), + tokenizer=SparseAutoTokenizer.from_pretrained(stub), target_path=target_path, sequence_length=384, task=task, @@ -68,6 +68,8 @@ def test_export_initialized_model_no_source_path(self, setup): inp.name == "past_key_values.0.key" for inp in onnx_model.graph.input ) + shutil.rmtree(tmp_path) + def test_export_happy_path(self, setup): source_path, target_path, task = setup export( diff --git a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf2.yaml b/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf2.yaml deleted file mode 100644 index a1a9df29b1c..00000000000 --- a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf2.yaml +++ /dev/null @@ -1,6 +0,0 @@ -cadence: "commit" -test_type: "smoke" -tokenize: False -model: "TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T" -dataset: open_platypus -recipe: "tests/sparseml/pytorch/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf3.yaml b/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf3.yaml deleted file mode 100644 index 38ecc948a39..00000000000 --- a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf3.yaml +++ /dev/null @@ -1,7 +0,0 @@ -cadence: "commit" -test_type: "smoke" -tokenize: False -model: "TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T" -dataset: "gsm8k" -dataset_config_name: "main" -recipe: "tests/sparseml/pytorch/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf5.yaml b/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf5.yaml deleted file mode 100644 index 8e8e86aa2bb..00000000000 --- a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf5.yaml +++ /dev/null @@ -1,6 +0,0 @@ -cadence: "commit" -test_type: "smoke" -tokenize: True -model: "TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T" -dataset: open_platypus -recipe: "tests/sparseml/pytorch/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf6.yaml b/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf6.yaml deleted file mode 100644 index b1eade5ab97..00000000000 --- a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf6.yaml +++ /dev/null @@ -1,6 +0,0 @@ -cadence: "commit" -test_type: "smoke" -tokenize: True -model: "TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T" -dataset: "gsm8k" -recipe: "tests/sparseml/pytorch/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/pytorch/utils/test_logger.py b/tests/sparseml/pytorch/utils/test_logger.py index 82510aea47a..343a0915fce 100644 --- a/tests/sparseml/pytorch/utils/test_logger.py +++ b/tests/sparseml/pytorch/utils/test_logger.py @@ -19,8 +19,7 @@ import pytest -from sparseml.pytorch.utils import ( - ClearMLLogger, +from sparseml.pytorch.utils import ( # ClearMLLogger, LambdaLogger, LoggerManager, PythonLogger, @@ -46,7 +45,8 @@ or True ), *([WANDBLogger()] if WANDBLogger.available() else []), - *([ClearMLLogger()] if ClearMLLogger.available() else []), + # TODO: uncomment this once the ClearML server hanging is fixed + # *([ClearMLLogger()] if ClearMLLogger.available() else []), SparsificationGroupLogger( lambda_func=lambda tag, value, values, step, wall_time, level: logging.info( f"{tag}, {value}, {values}, {step}, {wall_time}, {level}" diff --git a/tests/sparseml/pytorch/oneshot/__init__.py b/tests/sparseml/transformers/oneshot/__init__.py similarity index 100% rename from tests/sparseml/pytorch/oneshot/__init__.py rename to tests/sparseml/transformers/oneshot/__init__.py diff --git a/tests/sparseml/pytorch/oneshot/dataset_processing.py b/tests/sparseml/transformers/oneshot/dataset_processing.py similarity index 100% rename from tests/sparseml/pytorch/oneshot/dataset_processing.py rename to tests/sparseml/transformers/oneshot/dataset_processing.py diff --git a/tests/sparseml/pytorch/oneshot/oneshot_configs/recipes/recipe.yaml b/tests/sparseml/transformers/oneshot/oneshot_configs/recipes/recipe.yaml similarity index 100% rename from tests/sparseml/pytorch/oneshot/oneshot_configs/recipes/recipe.yaml rename to tests/sparseml/transformers/oneshot/oneshot_configs/recipes/recipe.yaml diff --git a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf1.yaml b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf1.yaml similarity index 84% rename from tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf1.yaml rename to tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf1.yaml index 59379b9aabd..d51a0ec420c 100644 --- a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf1.yaml +++ b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf1.yaml @@ -1,7 +1,7 @@ cadence: "commit" test_type: "smoke" tokenize: False -model: "TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T" +model: "Xenova/llama2.c-stories15M" dataset: open_platypus recipe: | test_stage: diff --git a/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf2.yaml b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf2.yaml new file mode 100644 index 00000000000..9ef9ced1020 --- /dev/null +++ b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf2.yaml @@ -0,0 +1,6 @@ +cadence: "commit" +test_type: "smoke" +tokenize: False +model: "Xenova/llama2.c-stories15M" +dataset: open_platypus +recipe: "tests/sparseml/transformers/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf3.yaml b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf3.yaml new file mode 100644 index 00000000000..4f468ced1b3 --- /dev/null +++ b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf3.yaml @@ -0,0 +1,7 @@ +cadence: "commit" +test_type: "smoke" +tokenize: False +model: "Xenova/llama2.c-stories15M" +dataset: "gsm8k" +dataset_config_name: "main" +recipe: "tests/sparseml/transformers/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf4.yaml b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf4.yaml similarity index 85% rename from tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf4.yaml rename to tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf4.yaml index a742208a09a..2dfc6553563 100644 --- a/tests/sparseml/pytorch/oneshot/oneshot_configs/tiny_stories_conf4.yaml +++ b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf4.yaml @@ -1,7 +1,7 @@ cadence: "commit" test_type: "smoke" tokenize: False -model: "TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T" +model: "Xenova/llama2.c-stories15M" dataset: "gsm8k" dataset_config_name: "main" recipe: | diff --git a/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf5.yaml b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf5.yaml new file mode 100644 index 00000000000..b3fffc71d40 --- /dev/null +++ b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf5.yaml @@ -0,0 +1,6 @@ +cadence: "commit" +test_type: "smoke" +tokenize: True +model: "Xenova/llama2.c-stories15M" +dataset: open_platypus +recipe: "tests/sparseml/transformers/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf6.yaml b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf6.yaml new file mode 100644 index 00000000000..36963d2e37f --- /dev/null +++ b/tests/sparseml/transformers/oneshot/oneshot_configs/tiny_stories_conf6.yaml @@ -0,0 +1,6 @@ +cadence: "commit" +test_type: "smoke" +tokenize: True +model: "Xenova/llama2.c-stories15M" +dataset: "gsm8k" +recipe: "tests/sparseml/transformers/oneshot/oneshot_configs/recipes/recipe.yaml" \ No newline at end of file diff --git a/tests/sparseml/pytorch/oneshot/test_api_inputs.py b/tests/sparseml/transformers/oneshot/test_api_inputs.py similarity index 94% rename from tests/sparseml/pytorch/oneshot/test_api_inputs.py rename to tests/sparseml/transformers/oneshot/test_api_inputs.py index 6f56bade73b..5ac548daac3 100644 --- a/tests/sparseml/pytorch/oneshot/test_api_inputs.py +++ b/tests/sparseml/transformers/oneshot/test_api_inputs.py @@ -18,11 +18,11 @@ import pytest from parameterized import parameterized_class -from tests.sparseml.pytorch.oneshot.dataset_processing import get_data_utils +from tests.sparseml.transformers.oneshot.dataset_processing import get_data_utils from tests.testing_utils import parse_params, requires_torch -CONFIGS_DIRECTORY = "tests/sparseml/pytorch/oneshot/oneshot_configs" +CONFIGS_DIRECTORY = "tests/sparseml/transformers/oneshot/oneshot_configs" # TODO: Seems better to mark test type (smoke, sanity, regression) as a marker as # opposed to using a field in the config file? diff --git a/tests/sparseml/pytorch/oneshot/test_cli.py b/tests/sparseml/transformers/oneshot/test_cli.py similarity index 96% rename from tests/sparseml/pytorch/oneshot/test_cli.py rename to tests/sparseml/transformers/oneshot/test_cli.py index 809d24f35bf..ff19689d355 100644 --- a/tests/sparseml/pytorch/oneshot/test_cli.py +++ b/tests/sparseml/transformers/oneshot/test_cli.py @@ -21,7 +21,7 @@ from tests.testing_utils import parse_params, requires_torch, run_cli_command -CONFIGS_DIRECTORY = "tests/sparseml/pytorch/oneshot/oneshot_configs" +CONFIGS_DIRECTORY = "tests/sparseml/transformers/oneshot/oneshot_configs" @pytest.mark.smoke