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: warning hub model #1301

Merged
Prev Previous commit
Next Next commit
Merge branch 'main' into update-warning-hub-model-id
  • Loading branch information
JohanWork committed Apr 3, 2024
commit 6a634e27c51d3b6beab0e1d0cb3da88bc25573fc
24 changes: 12 additions & 12 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,47 +1050,47 @@ def test_unfrozen_parameters_w_peft_layers_to_transform(self, minimal_cfg):
):
validate_config(cfg)

def test_hub_model_id_save_value_warns_save_stragey_no(self):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "no"})
def test_hub_model_id_save_value_warns_save_stragey_no(self, minimal_cfg):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "no"}) | minimal_cfg

with self._caplog.at_level(logging.WARNING):
validate_config(cfg)
assert (
"set without any models being saved" in self._caplog.records[0].message
)

def test_hub_model_id_save_value_warns_random_value(self):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "test"})
def test_hub_model_id_save_value_warns_random_value(self, minimal_cfg):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "test"}) | minimal_cfg

with self._caplog.at_level(logging.WARNING):
validate_config(cfg)
assert (
"set without any models being saved" in self._caplog.records[0].message
)

def test_hub_model_id_save_value_steps(self):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "steps"})
def test_hub_model_id_save_value_steps(self, minimal_cfg):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "steps"}) | minimal_cfg

with self._caplog.at_level(logging.WARNING):
validate_config(cfg)
assert len(self._caplog.records) == 0

def test_hub_model_id_save_value_epochs(self):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "epoch"})
def test_hub_model_id_save_value_epochs(self, minimal_cfg):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": "epoch"}) | minimal_cfg

with self._caplog.at_level(logging.WARNING):
validate_config(cfg)
assert len(self._caplog.records) == 0

def test_hub_model_id_save_value_none(self):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": None})
def test_hub_model_id_save_value_none(self, minimal_cfg):
cfg = DictDefault({"hub_model_id": "test", "save_strategy": None}) | minimal_cfg

with self._caplog.at_level(logging.WARNING):
validate_config(cfg)
assert len(self._caplog.records) == 0

def test_hub_model_id_save_value_no_set_save_strategy(self):
cfg = DictDefault({"hub_model_id": "test"})
def test_hub_model_id_save_value_no_set_save_strategy(self, minimal_cfg):
cfg = DictDefault({"hub_model_id": "test"}) | minimal_cfg

with self._caplog.at_level(logging.WARNING):
validate_config(cfg)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.