From c535dc4482906e5886e2d4009edd64d306e5dd4e Mon Sep 17 00:00:00 2001 From: Ajay Patel Date: Thu, 2 May 2024 00:51:04 -0400 Subject: [PATCH] Support fingerprinting Step in stable_fingerprint [release] --- pyproject.toml | 2 +- src/utils/fingerprint_utils.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 31ea9a0..57bf483 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "DataDreamer" -version = "0.34.0" +version = "0.35.0" description = "Prompt. Generate Synthetic Data. Train & Align Models." license = "MIT" authors= [ diff --git a/src/utils/fingerprint_utils.py b/src/utils/fingerprint_utils.py index 062930d..769629e 100644 --- a/src/utils/fingerprint_utils.py +++ b/src/utils/fingerprint_utils.py @@ -48,6 +48,7 @@ def _DatasetGeneratorPickleHack_raise(*args, **kwargs): # pragma: no cover def stable_fingerprint(value: Any) -> str: + from ..steps import Step from ..trainers import Trainer if isinstance(value, (list, tuple, set)): @@ -55,8 +56,9 @@ def stable_fingerprint(value: Any) -> str: elif isinstance(value, dict): return Hasher.hash({k: stable_fingerprint(v) for k, v in value.items()}) else: - if isinstance(value, Trainer): - assert value._done, f"Trainer '{value.name}' has not been run yet. Use `.train()` to start training." + if isinstance(value, Step) or isinstance(value, Trainer): + if isinstance(value, Trainer): + assert value._done, f"Trainer '{value.name}' has not been run yet. Use `.train()` to start training." return cast(str, value.fingerprint) if is_peft_model(value): # pragma: no cover return stable_fingerprint(