diff options
author | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-02 14:06:47 +0000 |
---|---|---|
committer | Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> | 2023-12-02 14:06:47 +0000 |
commit | 50a21cb09fe3e9ea2d4fe058e0484e192c8a86e3 (patch) | |
tree | 58a7bb3327708fc9a7a7e76a5348c1cd71e3d251 | |
parent | 110485d5bb511ab01ac3d890f1deca0502f4c7db (diff) | |
download | stable-diffusion-webui-gfx803-50a21cb09fe3e9ea2d4fe058e0484e192c8a86e3.tar.gz stable-diffusion-webui-gfx803-50a21cb09fe3e9ea2d4fe058e0484e192c8a86e3.tar.bz2 stable-diffusion-webui-gfx803-50a21cb09fe3e9ea2d4fe058e0484e192c8a86e3.zip |
Ensure the cached weight will not be affected
-rw-r--r-- | modules/sd_models.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index 4b8a9ae6..dcf816b3 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -435,9 +435,9 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer for module in model.modules():
if isinstance(module, (torch.nn.Conv2d, torch.nn.Linear)):
if shared.opts.cache_fp16_weight:
- module.fp16_weight = module.weight.clone().half()
+ module.fp16_weight = module.weight.data.clone().cpu().half()
if module.bias is not None:
- module.fp16_bias = module.bias.clone().half()
+ module.fp16_bias = module.bias.data.clone().cpu().half()
module.to(torch.float8_e4m3fn)
model.first_stage_model = first_stage
timer.record("apply fp8")
|