aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_models.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-10-02 12:03:39 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-10-02 12:03:39 +0000
commit820f1dc96b1979d7e92170c161db281ee8bd988b (patch)
treec2b04366563537cddc4cdb2e65a94da2a8d90fc8 /modules/sd_models.py
parent84e97a98c5233119d0f444e0a3a0f6391da23677 (diff)
downloadstable-diffusion-webui-gfx803-820f1dc96b1979d7e92170c161db281ee8bd988b.tar.gz
stable-diffusion-webui-gfx803-820f1dc96b1979d7e92170c161db281ee8bd988b.tar.bz2
stable-diffusion-webui-gfx803-820f1dc96b1979d7e92170c161db281ee8bd988b.zip
initial support for training textual inversion
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r--modules/sd_models.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py
index 2539f14c..5b3dbdc7 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -8,7 +8,7 @@ from omegaconf import OmegaConf
from ldm.util import instantiate_from_config
-from modules import shared, modelloader
+from modules import shared, modelloader, devices
from modules.paths import models_path
model_dir = "Stable-diffusion"
@@ -134,6 +134,8 @@ def load_model_weights(model, checkpoint_file, sd_model_hash):
if not shared.cmd_opts.no_half:
model.half()
+ devices.dtype = torch.float32 if shared.cmd_opts.no_half else torch.float16
+
model.sd_model_hash = sd_model_hash
model.sd_model_checkpint = checkpoint_file