Skip to content

Commit cb0bf28

Browse files
feat: update serialization tests to handle None backbone model type
1 parent 94ae758 commit cb0bf28

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

tests/test_config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
def test_serialize_deserialize(module: LightningIRModule, tmp_path: Path):
1010
config = module.model.config
1111
config_class = module.model.config_class
12-
assert config.backbone_model_type == "bert"
1312
assert config.get_backbone_model_type() == "bert"
1413
save_dir = str(tmp_path / config_class.model_type)
1514
config.save_pretrained(save_dir)
@@ -31,4 +30,7 @@ def test_serialize_deserialize(module: LightningIRModule, tmp_path: Path):
3130
"_experts_implementation_internal",
3231
):
3332
continue
33+
if key == "backbone_model_type" and value is None:
34+
assert new_config.get_backbone_model_type() == config.get_backbone_model_type()
35+
continue
3436
assert getattr(new_config, key) == value

tests/test_model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def test_seralize_deserialize(module: LightningIRModule, tmp_path: Path):
9494
"_attn_implementation_autoset",
9595
):
9696
continue
97+
if key == "backbone_model_type" and value is None:
98+
assert new_model.config.get_backbone_model_type() == model.config.get_backbone_model_type()
99+
continue
97100
assert getattr(new_model.config, key) == value
98101
for key, value in model.state_dict().items():
99102
assert new_model.state_dict()[key].equal(value)

0 commit comments

Comments
 (0)