Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warmup for eval #855

Merged
merged 8 commits into from
Mar 31, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Disable safe loading tests in CI (#854)
  • Loading branch information
regisss committed Mar 30, 2024
commit 8ee87de9085d13593c1b20ada9b1b99a0715da69
17 changes: 17 additions & 0 deletions tests/test_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
get_gpu_count,
get_tests_dir,
is_staging_test,
parse_flag_from_env,
require_optuna,
require_safetensors,
require_sentencepiece,
Expand Down Expand Up @@ -90,6 +91,20 @@
PATH_SAMPLE_TEXT = f"{get_tests_dir()}/fixtures/sample_text.txt"


_run_safe_loading_tests_ = parse_flag_from_env("SAFE_LOADING_TESTS", default=False)


def safe_loading_test(test_case):
"""
Decorator marking a test as needing custom bf16 ops.
Custom bf16 ops must be declared before `habana_frameworks.torch.core` is imported, which is not possible if some other tests are executed before.

Such tests are skipped by default. Set the CUSTOM_BF16_OPS environment variable to a truthy value to run them.

"""
return unittest.skipUnless(_run_safe_loading_tests_, "test requires SAFE_LOADING_TESTS")(test_case)


class RegressionDataset:
def __init__(self, a=2, b=3, length=64, seed=42, label_names=None):
np.random.seed(seed)
Expand Down Expand Up @@ -1465,6 +1480,7 @@ def test_training_with_resume_from_checkpoint_false(self):

trainer.train(resume_from_checkpoint=False)

@safe_loading_test
@require_safetensors
def test_resume_training_with_safe_checkpoint(self):
# This test will fail for more than 2 GPUs since the batch size will get bigger and with the number of
Expand Down Expand Up @@ -1658,6 +1674,7 @@ def test_load_best_model_at_end(self):
self.check_saved_checkpoints(tmpdir, 5, total, is_pretrained=False)
self.check_best_model_has_been_loaded(tmpdir, 5, total, trainer, "eval_loss", is_pretrained=False)

@safe_loading_test
@require_safetensors
def test_load_best_model_from_safetensors(self):
total = int(self.n_epochs * 64 / self.batch_size)
Expand Down
Loading