Skip to content

Commit

Permalink
Support fingerprinting Step in stable_fingerprint [release]
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayP13 committed May 2, 2024
1 parent ca14270 commit c535dc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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= [
Expand Down
6 changes: 4 additions & 2 deletions src/utils/fingerprint_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,17 @@ 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)):
return Hasher.hash([type(value), [stable_fingerprint(v) for v in value]])
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(
Expand Down

0 comments on commit c535dc4

Please sign in to comment.