Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ to communicate reliably.
of model it is.
- Made sure that LoRA layers are trainable.
- Limiting W&B job names to 128 characters.
- Fixed run metadata file not being saved in the W&B artifact, meaning the run package
version wasn't being determined correctly.


## [2.0.0] - 2025-06-16
Expand Down
3 changes: 3 additions & 0 deletions nip/parameters/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ def convert_hyper_param_dict(hyper_param_dict: dict) -> dict:
hyper_param_dict = conversion_func(hyper_param_dict)
dict_version = next_version

# Finally, set the _package_version field to the current version
hyper_param_dict["_package_version"] = version_tuple_to_string(current_version)

return hyper_param_dict


Expand Down
10 changes: 10 additions & 0 deletions nip/trainers/trainer_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def save_checkpoint(self, log: bool = True):
CHECKPOINT_STATE_ARTIFACT_TYPE,
)
artifact.add_file(self.checkpoint_state_path)
artifact.add_file(self.checkpoint_metadata_path)
artifact.add_file(self.checkpoint_params_path)
self.settings.wandb_run.log_artifact(artifact)

Expand Down Expand Up @@ -328,6 +329,15 @@ def _load_state_dict_from_active_run_checkpoint(self) -> dict:
metadata = json.load(f)
package_name = metadata.get("package_name", None)
package_version = metadata.get("package_version", None)

# Fall back to reading the hyper parameters file, which should contain the
# package name and version
elif self.checkpoint_params_path.exists():
with open(self.checkpoint_params_path, "r") as f:
hyper_params = json.load(f)
package_name = hyper_params.get("_package_name", None)
package_version = hyper_params.get("_package_version", None)

else:
package_name = None
package_version = None
Expand Down