From a1147b0f040ad80b323907f9a6ad66c3a5a14dce Mon Sep 17 00:00:00 2001 From: PommesPeter Date: Wed, 21 Feb 2024 11:45:54 +0800 Subject: [PATCH 1/2] :pencil2: Fixed random_seed --- test/legacy_test/dist_allreduce_op.py | 3 +-- test/legacy_test/dist_ctr.py | 3 +-- test/legacy_test/dist_fleet_ctr.py | 3 +-- test/legacy_test/dist_fleet_ctr_ps_gpu.py | 3 +-- test/legacy_test/dist_fleet_heter_pipeline_ctr.py | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/test/legacy_test/dist_allreduce_op.py b/test/legacy_test/dist_allreduce_op.py index ba2ec0180a299..ccf9383e1d6da 100644 --- a/test/legacy_test/dist_allreduce_op.py +++ b/test/legacy_test/dist_allreduce_op.py @@ -27,8 +27,7 @@ paddle.dataset.mnist.fetch() # Fix seed for test -base.default_startup_program().random_seed = 1 -base.default_main_program().random_seed = 1 +paddle.seed(2023) def cnn_model(data): diff --git a/test/legacy_test/dist_ctr.py b/test/legacy_test/dist_ctr.py index 7b1010067cea0..560ad6a7d3bba 100644 --- a/test/legacy_test/dist_ctr.py +++ b/test/legacy_test/dist_ctr.py @@ -24,8 +24,7 @@ os.environ['PADDLE_ENABLE_REMOTE_PREFETCH'] = "1" # Fix seed for test -base.default_startup_program().random_seed = 1 -base.default_main_program().random_seed = 1 +paddle.seed(1) class TestDistCTR2x2(TestDistRunnerBase): diff --git a/test/legacy_test/dist_fleet_ctr.py b/test/legacy_test/dist_fleet_ctr.py index 0d57a7c73e13d..4b35bbe9dcde8 100644 --- a/test/legacy_test/dist_fleet_ctr.py +++ b/test/legacy_test/dist_fleet_ctr.py @@ -30,8 +30,7 @@ paddle.enable_static() # Fix seed for test -base.default_startup_program().random_seed = 1 -base.default_main_program().random_seed = 1 +paddle.seed(1) def fake_ctr_reader(): diff --git a/test/legacy_test/dist_fleet_ctr_ps_gpu.py b/test/legacy_test/dist_fleet_ctr_ps_gpu.py index 093a93e9a2c85..a50c1d9a2f63f 100644 --- a/test/legacy_test/dist_fleet_ctr_ps_gpu.py +++ b/test/legacy_test/dist_fleet_ctr_ps_gpu.py @@ -29,8 +29,7 @@ from paddle import base # Fix seed for test -base.default_startup_program().random_seed = 1 -base.default_main_program().random_seed = 1 +paddle.seed(1) class TestDistGpuPsCTR2x2(TestDistCTR2x2): diff --git a/test/legacy_test/dist_fleet_heter_pipeline_ctr.py b/test/legacy_test/dist_fleet_heter_pipeline_ctr.py index cb33e527d4155..95ec671b38bd0 100644 --- a/test/legacy_test/dist_fleet_heter_pipeline_ctr.py +++ b/test/legacy_test/dist_fleet_heter_pipeline_ctr.py @@ -27,8 +27,7 @@ paddle.enable_static() # Fix seed for test -base.default_startup_program().random_seed = 1 -base.default_main_program().random_seed = 1 +paddle.seed(1) class TestHeterPipelinePsCTR2x2(FleetDistHeterRunnerBase): From 8849590dc2542000daa7b8550e359f3551e3e663 Mon Sep 17 00:00:00 2001 From: PommesPeter <54879512+PommesPeter@users.noreply.github.com> Date: Wed, 21 Feb 2024 11:51:01 +0800 Subject: [PATCH 2/2] Update dist_allreduce_op.py --- test/legacy_test/dist_allreduce_op.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/legacy_test/dist_allreduce_op.py b/test/legacy_test/dist_allreduce_op.py index ccf9383e1d6da..6604cf15f7a40 100644 --- a/test/legacy_test/dist_allreduce_op.py +++ b/test/legacy_test/dist_allreduce_op.py @@ -27,7 +27,7 @@ paddle.dataset.mnist.fetch() # Fix seed for test -paddle.seed(2023) +paddle.seed(1) def cnn_model(data):