Skip to content

Commit

Permalink
Add random_seed field for reproducible DARE merges
Browse files Browse the repository at this point in the history
  • Loading branch information
cg123 committed Dec 10, 2023
1 parent d707173 commit 4a2f3fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mergekit/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class MergeOptions(BaseModel):
allow_crimes: bool = False
clone_tensors: bool = False
trust_remote_code: bool = False
random_seed: Optional[int] = None
lazy_unpickle: bool = False


Expand All @@ -51,6 +52,9 @@ def run_merge(merge_config: MergeConfiguration, out_path: str, options: MergeOpt
"float32": torch.float32,
}[merge_config.dtype]

if options.random_seed is not None:
transformers.trainer_utils.set_seed(options.random_seed)

if not merge_config.models and not merge_config.slices:
raise RuntimeError("No output requested")

Expand Down

0 comments on commit 4a2f3fe

Please sign in to comment.