Skip to content

Commit 7de08af

Browse files
authored
update metadata notation (#101)
1 parent 538dd92 commit 7de08af

File tree

8 files changed

+9
-9
lines changed

8 files changed

+9
-9
lines changed

src/litmodels/integrations/checkpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def _upload_model(self, trainer: "pl.Trainer", filepath: Union[str, Path], metad
193193
mro = inspect.getmro(type(self))
194194
abc_index = mro.index(LitModelCheckpointMixin)
195195
ckpt_class = mro[abc_index - 1]
196-
metadata.update({"litModels_integration": ckpt_class.__name__})
196+
metadata.update({"litModels.integration": ckpt_class.__name__})
197197
# Add to queue instead of uploading directly
198198
get_model_manager().queue_upload(registry_name=model_registry, filepath=filepath, metadata=metadata)
199199
if self._clear_all_local:

src/litmodels/integrations/duplicate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ def duplicate_hf_model(
6464
lit_model = model_name
6565
if not metadata:
6666
metadata = {}
67-
metadata.update({"litModels_integration": "duplicate_hf_model", "hf_model": hf_model})
67+
metadata.update({"litModels.integration": "duplicate_hf_model", "hf_model": hf_model})
6868
model = upload_model_files(name=lit_model, path=local_workdir / model_name, verbose=verbose, metadata=metadata)
6969
return model.name

src/litmodels/integrations/mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _upload_model_files(
6565
mro = inspect.getmro(type(self))
6666
abc_index = mro.index(ModelRegistryMixin)
6767
mixin_class = mro[abc_index - 1]
68-
metadata.update({"litModels_integration": mixin_class.__name__})
68+
metadata.update({"litModels.integration": mixin_class.__name__})
6969
upload_model_files(name=name, path=path, metadata=metadata)
7070

7171

src/litmodels/io/gateway.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def save_model(
103103

104104
if not metadata:
105105
metadata = {}
106-
metadata.update({"litModels_integration": "save_model"})
106+
metadata.update({"litModels.integration": "save_model"})
107107

108108
return upload_model(
109109
model=path,

tests/integrations/test_checkpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def test_lightning_checkpoint_callback(
104104
path=mock.ANY,
105105
progress_bar=True,
106106
cloud_account=None,
107-
metadata={"litModels_integration": LitModelCheckpoint.__name__, "litModels": litmodels.__version__},
107+
metadata={"litModels.integration": LitModelCheckpoint.__name__, "litModels": litmodels.__version__},
108108
)
109109
for v in ("epoch=0-step=64", "epoch=1-step=128")
110110
]

tests/integrations/test_duplicate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def test_duplicate_hf_model(mock_upload_model, mock_snapshot_download, tmp_path)
2626
mock_upload_model.assert_called_with(
2727
name=f"{model_name}",
2828
path=tmp_path / hf_model.replace("/", "_"),
29-
metadata={"hf_model": hf_model, "litModels_integration": "duplicate_hf_model"},
29+
metadata={"hf_model": hf_model, "litModels.integration": "duplicate_hf_model"},
3030
verbose=1,
3131
)

tests/integrations/test_mixins.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_pickle_push_and_pull(mock_download_model, mock_upload_model, tmp_path):
2424
# The expected registry name is "dummy_model:v1" and the file should be placed in the temp folder.
2525
expected_path = tmp_path / "DummyModel.pkl"
2626
mock_upload_model.assert_called_once_with(
27-
name="DummyModel:v1", path=expected_path, metadata={"litModels_integration": "PickleRegistryMixin"}
27+
name="DummyModel:v1", path=expected_path, metadata={"litModels.integration": "PickleRegistryMixin"}
2828
)
2929

3030
# Set the mock to return the full path to the pickle file.
@@ -78,7 +78,7 @@ def test_pytorch_push_and_pull(mock_download_model, mock_upload_model, torch_cla
7878
mock_upload_model.assert_called_once_with(
7979
name=torch_class.__name__,
8080
path=[tmp_path / f"{torch_class.__name__}.pth", json_path],
81-
metadata={"litModels_integration": "PyTorchRegistryMixin"},
81+
metadata={"litModels.integration": "PyTorchRegistryMixin"},
8282
)
8383

8484
# Prepare mocking for pull_from_registry.

tests/test_io_cloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_upload_model(mock_upload_model, tmp_path, model, model_path, verbose):
8484
name="org-name/teamspace/model-name",
8585
cloud_account="cluster_id",
8686
progress_bar=True,
87-
metadata={"litModels": litmodels.__version__, "litModels_integration": "save_model"},
87+
metadata={"litModels": litmodels.__version__, "litModels.integration": "save_model"},
8888
)
8989

9090

0 commit comments

Comments
 (0)