mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-02-08 14:42:54 +08:00
do not use copy option for nn.Embedding
This commit is contained in:
parent
ba499f92ac
commit
5f3314ec43
@ -201,7 +201,7 @@ def manual_cast_forward(target_dtype, target_device=None, copy=False):
|
|||||||
org_dtype = param.dtype
|
org_dtype = param.dtype
|
||||||
break
|
break
|
||||||
|
|
||||||
if copy:
|
if copy and not isinstance(self, torch.nn.Embedding):
|
||||||
copied = deepcopy(self)
|
copied = deepcopy(self)
|
||||||
if org_dtype != target_dtype:
|
if org_dtype != target_dtype:
|
||||||
copied.to(**params)
|
copied.to(**params)
|
||||||
@ -266,8 +266,6 @@ def autocast(disable=False, current_dtype=None, target_dtype=None, target_device
|
|||||||
|
|
||||||
if target_dtype is None:
|
if target_dtype is None:
|
||||||
target_dtype = dtype
|
target_dtype = dtype
|
||||||
if target_device is None:
|
|
||||||
target_device = device
|
|
||||||
|
|
||||||
if force_fp16:
|
if force_fp16:
|
||||||
# No casting during inference if force_fp16 is enabled.
|
# No casting during inference if force_fp16 is enabled.
|
||||||
|
Loading…
Reference in New Issue
Block a user