From 2866f5196cd9c00769586b543f5db494e84a9a5f Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Thu, 4 Apr 2024 23:12:49 -0400 Subject: [PATCH] fix misplaced lock call --- invokeai/backend/model_manager/load/model_cache/model_locker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invokeai/backend/model_manager/load/model_cache/model_locker.py b/invokeai/backend/model_manager/load/model_cache/model_locker.py index ea38d3773c..a275987773 100644 --- a/invokeai/backend/model_manager/load/model_cache/model_locker.py +++ b/invokeai/backend/model_manager/load/model_cache/model_locker.py @@ -33,13 +33,13 @@ class ModelLocker(ModelLockerBase): return self.model # NOTE that the model has to have the to() method in order for this code to move it into GPU! + self._cache_entry.lock() try: if self._cache.lazy_offloading: self._cache.offload_unlocked_models(self._cache_entry.size) self._cache.move_model_to_device(self._cache_entry, self._cache.execution_device) self._cache_entry.loaded = True - self._cache_entry.lock() self._cache.logger.debug(f"Locking {self._cache_entry.key} in {self._cache.execution_device}") self._cache.print_cuda_stats()