Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
dakinggg committed Jul 26, 2024
1 parent 020842d commit d1a5465
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/a_scripts/inference/test_convert_composer_to_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ def test_huggingface_conversion_callback_interval(
checkpointer_callback.transform_model_pre_registration = MagicMock(
wraps=checkpointer_callback.transform_model_pre_registration,
)
checkpointer_callback.pre_register_edit = MagicMock(
wraps=checkpointer_callback.pre_register_edit,
)
trainer = Trainer(
model=original_model,
device='gpu',
Expand All @@ -413,9 +416,11 @@ def test_huggingface_conversion_callback_interval(
metadata={},
)
assert checkpointer_callback.transform_model_pre_registration.call_count == 1
assert checkpointer_callback.pre_register_edit.call_count == 1
assert mlflow_logger_mock.register_model_with_run_id.call_count == 1
else:
assert checkpointer_callback.transform_model_pre_registration.call_count == 0
assert checkpointer_callback.pre_register_edit.call_count == 0
assert mlflow_logger_mock.save_model.call_count == 0
assert mlflow_logger_mock.register_model_with_run_id.call_count == 0

Expand Down

0 comments on commit d1a5465

Please sign in to comment.