From ff2c2a15bb55be76e681485eb0e1fe2e33cbb206 Mon Sep 17 00:00:00 2001 From: Nicolas Gong Date: Thu, 18 Aug 2022 22:59:40 +0800 Subject: [PATCH] fix the bug of RuntimeError: a leaf Variable that requires grad is being used in an in-place operation --- improved_diffusion/dist_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/improved_diffusion/dist_util.py b/improved_diffusion/dist_util.py index f665604d6b..d2c509be64 100644 --- a/improved_diffusion/dist_util.py +++ b/improved_diffusion/dist_util.py @@ -69,7 +69,7 @@ def sync_params(params): """ for p in params: with th.no_grad(): - dist.broadcast(p, 0) + dist.broadcast(p.detach(), 0) def _find_free_port():