From 046666c29f597472ff1b2577477f159577c8b505 Mon Sep 17 00:00:00 2001 From: wenzhangliu Date: Fri, 20 Sep 2024 23:36:48 +0800 Subject: [PATCH] torchrun for DDP --- xuance/torch/agents/base/agent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xuance/torch/agents/base/agent.py b/xuance/torch/agents/base/agent.py index 42fbcff8..76eda6b8 100644 --- a/xuance/torch/agents/base/agent.py +++ b/xuance/torch/agents/base/agent.py @@ -242,6 +242,7 @@ def finish(self): if self.distributed_training: if dist.get_rank() == 0: if os.path.exists(self.learner.snapshot_path): - os.remove(os.path.join(self.learner.snapshot_path, "snapshot.pt")) + if os.path.exists(os.path.join(self.learner.snapshot_path, "snapshot.pt")): + os.remove(os.path.join(self.learner.snapshot_path, "snapshot.pt")) os.removedirs(self.learner.snapshot_path) destroy_process_group()