From aaf1a6d1dd5dbfb73fccbf2334811f50110125dc Mon Sep 17 00:00:00 2001 From: Thiyagarajan <35857753+thiyagu145@users.noreply.github.com> Date: Tue, 6 Jul 2021 12:51:31 -0700 Subject: [PATCH 1/4] Move queue to gpu when preloading The current queue loading fails when resuming training with checkpointed queue. This PR moves the queue to GPU when resuming from checkpoint. --- pl_bolts/models/self_supervised/swav/swav_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pl_bolts/models/self_supervised/swav/swav_module.py b/pl_bolts/models/self_supervised/swav/swav_module.py index a6e2c61017..31b790026c 100644 --- a/pl_bolts/models/self_supervised/swav/swav_module.py +++ b/pl_bolts/models/self_supervised/swav/swav_module.py @@ -183,8 +183,8 @@ def on_train_epoch_start(self): self.feat_dim, ) - if self.gpus > 0: - self.queue = self.queue.cuda() + if self.gpus > 0 and self.queue is not None: + self.queue = self.queue.cuda() self.use_the_queue = False From effb7ca5dc57856f1aebc62a1ae20cfbb0fc869f Mon Sep 17 00:00:00 2001 From: Ananya Harsh Jha Date: Thu, 15 Jul 2021 19:13:27 -0400 Subject: [PATCH 2/4] Update pl_bolts/models/self_supervised/swav/swav_module.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Adrian Wälchli --- pl_bolts/models/self_supervised/swav/swav_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pl_bolts/models/self_supervised/swav/swav_module.py b/pl_bolts/models/self_supervised/swav/swav_module.py index 31b790026c..780647d766 100644 --- a/pl_bolts/models/self_supervised/swav/swav_module.py +++ b/pl_bolts/models/self_supervised/swav/swav_module.py @@ -183,8 +183,8 @@ def on_train_epoch_start(self): self.feat_dim, ) - if self.gpus > 0 and self.queue is not None: - self.queue = self.queue.cuda() + self.queue is not None: + self.queue = self.queue.to(self.device) self.use_the_queue = False From aff74f2243bff230cc9b654e585de4bbddf6d3f0 Mon Sep 17 00:00:00 2001 From: Thiyagarajan <35857753+thiyagu145@users.noreply.github.com> Date: Thu, 15 Jul 2021 16:33:54 -0700 Subject: [PATCH 3/4] update change log for PR 684 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a247597da4..5b2015e958 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed momentum updating from val step and add separate val queue ([#631](https://github.com/PyTorchLightning/lightning-bolts/pull/631)) +- Fixed moving the queue to GPU when resuming checkpoint for SwAV model ([#684](https://github.com/PyTorchLightning/lightning-bolts/pull/684)) + ## [0.3.4] - 2021-06-17 From 007f1a7152211dd47fbb41504e9ba190f4c922cd Mon Sep 17 00:00:00 2001 From: Thiyagarajan <35857753+thiyagu145@users.noreply.github.com> Date: Wed, 28 Jul 2021 10:58:22 -0700 Subject: [PATCH 4/4] missing if --- pl_bolts/models/self_supervised/swav/swav_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pl_bolts/models/self_supervised/swav/swav_module.py b/pl_bolts/models/self_supervised/swav/swav_module.py index 780647d766..ad963784ce 100644 --- a/pl_bolts/models/self_supervised/swav/swav_module.py +++ b/pl_bolts/models/self_supervised/swav/swav_module.py @@ -183,7 +183,7 @@ def on_train_epoch_start(self): self.feat_dim, ) - self.queue is not None: + if self.queue is not None: self.queue = self.queue.to(self.device) self.use_the_queue = False