Skip to content

Commit 12073b1

Browse files
authored
Sync random seed across ranks in distributed chat (ml-explore#801)
* Sync random seed across ranks in distributed chat * Use seed if provided * Set default seed
1 parent d9846d3 commit 12073b1

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

mlx_lm/chat.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
DEFAULT_TOP_P = 1.0
1414
DEFAULT_XTC_PROBABILITY = 0.0
1515
DEFAULT_XTC_THRESHOLD = 0.0
16-
DEFAULT_SEED = None
16+
DEFAULT_SEED = 0
1717
DEFAULT_MAX_TOKENS = 256
1818
DEFAULT_MODEL = "mlx-community/Llama-3.2-3B-Instruct-4bit"
1919

@@ -100,8 +100,7 @@ def rprint(*args, **kwargs):
100100
if rank == 0:
101101
print(*args, **kwargs)
102102

103-
if args.seed is not None:
104-
mx.random.seed(args.seed)
103+
mx.random.seed(args.seed)
105104

106105
if group.size() > 1:
107106
if args.adapter_path:

0 commit comments

Comments
 (0)