Skip to content

Commit ecbec8b

Browse files
committed
log only worker-0 stats
1 parent 748b673 commit ecbec8b

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sota-implementations/a3c/a3c_atari.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ def run(self):
181181
metrics_to_log[f"train/{key}"] = value.item()
182182

183183
metrics_to_log["train/lr"] = lr * alpha
184-
if self.logger:
184+
185+
# Logging only on the first worker in the dashboard.
186+
# Alternatively, you can use a distributed logger, or aggregate metrics from all workers.
187+
if self.logger and self.name == "worker_0":
185188
for key, value in metrics_to_log.items():
186189
self.logger.log_scalar(key, value, collected_frames)
187190
collector.shutdown()

sota-implementations/a3c/config_atari.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ env:
77
# collector
88
collector:
99
frames_per_batch: 800
10-
total_frames: 40_000_000
10+
total_frames: 40_000_00
1111

1212
# logger
1313
logger:
1414
backend: wandb
15-
project_name: torchrl_example_a2c
15+
project_name: torchrl_example_a3c
1616
group_name: null
17-
exp_name: Atari_Schulman17
17+
exp_name: a3c_atari_training
1818
test_interval: 40_000_000
1919
num_test_episodes: 3
2020
video: False

0 commit comments

Comments
 (0)