aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>2024-01-29 22:54:12 +0800
committerKohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com>2024-01-29 22:54:12 +0800
commitf9ba7e648ad5bf7dbdf2b95fa207936179bf784e (patch)
tree3549de31fff495174f6de7f53b432596d0eb6bc7
parentd243e24f539d717b221992e894a5db5a321bf3cd (diff)
Revert "Try to reverse the dtype checking mechanism"
This reverts commit d243e24f539d717b221992e894a5db5a321bf3cd.
-rw-r--r--modules/devices.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/devices.py b/modules/devices.py
index f9648e9a..8f49f7a4 100644
--- a/modules/devices.py
+++ b/modules/devices.py
@@ -4,7 +4,6 @@ from functools import lru_cache
import torch
from modules import errors, shared
-from modules import torch_utils
if sys.platform == "darwin":
from modules import mac_specific
@@ -141,7 +140,11 @@ def manual_cast_forward(target_dtype):
args = [arg.to(target_dtype) if isinstance(arg, torch.Tensor) else arg for arg in args]
kwargs = {k: v.to(target_dtype) if isinstance(v, torch.Tensor) else v for k, v in kwargs.items()}
- org_dtype = torch_utils.get_param(self).dtype
+ org_dtype = target_dtype
+ for param in self.parameters():
+ if param.dtype != target_dtype:
+ org_dtype = param.dtype
+ break
if org_dtype != target_dtype:
self.to(target_dtype)