Skip to content

Commit f02a4da

Browse files
authored
Merge pull request #12152 from seiriosPlus/dis_acc_fix
slice_var_up=False fix
2 parents 0042ba9 + 8f9e23d commit f02a4da

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

python/paddle/fluid/transpiler/distribute_transpiler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from __future__ import print_function
3232

3333
import math
34+
import random
3435
import numpy as np
3536

3637
from ps_dispatcher import RoundRobin, HashName, PSDispatcher
@@ -197,7 +198,8 @@ def transpile(self,
197198
# shuffle the map will avoid the uneven distribution above
198199
grad_var_mapping_items = self.grad_var_mapping.items()
199200
if not slice_var_up:
200-
np.random.shuffle(grad_var_mapping_items)
201+
random.seed(self.trainer_num)
202+
random.shuffle(grad_var_mapping_items)
201203

202204
for orig_varname, splited_vars in grad_var_mapping_items:
203205
eplist = ps_dispatcher.dispatch(splited_vars)

0 commit comments

Comments
 (0)