mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-11 20:27:44 +08:00
Revert "MPDynamic: Pre-generate the tensors for vbars"
This reverts commit 12028af97b.
This commit is contained in:
parent
76a7fa96db
commit
89dc4a8df8
@ -1213,7 +1213,8 @@ def cast_to(weight, dtype=None, device=None, non_blocking=False, copy=False, str
|
|||||||
|
|
||||||
signature = comfy_aimdo.model_vbar.vbar_fault(weight._v)
|
signature = comfy_aimdo.model_vbar.vbar_fault(weight._v)
|
||||||
if signature is not None:
|
if signature is not None:
|
||||||
v_tensor = comfy.memory_management.interpret_gathered_like(cast_geometry, weight._v_tensor)[0]
|
raw_tensor = comfy_aimdo.torch.aimdo_to_tensor(weight._v, device)
|
||||||
|
v_tensor = comfy.memory_management.interpret_gathered_like(cast_geometry, raw_tensor)[0]
|
||||||
if not comfy_aimdo.model_vbar.vbar_signature_compare(signature, weight._v_signature):
|
if not comfy_aimdo.model_vbar.vbar_signature_compare(signature, weight._v_signature):
|
||||||
weight._v_signature = signature
|
weight._v_signature = signature
|
||||||
#Send it over
|
#Send it over
|
||||||
|
|||||||
@ -1542,7 +1542,6 @@ class ModelPatcherDynamic(ModelPatcher):
|
|||||||
|
|
||||||
if vbar is not None and not hasattr(m, "_v"):
|
if vbar is not None and not hasattr(m, "_v"):
|
||||||
m._v = vbar.alloc(v_weight_size)
|
m._v = vbar.alloc(v_weight_size)
|
||||||
m._v_tensor = comfy_aimdo.torch.aimdo_to_tensor(m._v, device_to)
|
|
||||||
allocated_size += v_weight_size
|
allocated_size += v_weight_size
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -1557,7 +1556,6 @@ class ModelPatcherDynamic(ModelPatcher):
|
|||||||
weight_size = geometry.numel() * geometry.element_size()
|
weight_size = geometry.numel() * geometry.element_size()
|
||||||
if vbar is not None and not hasattr(weight, "_v"):
|
if vbar is not None and not hasattr(weight, "_v"):
|
||||||
weight._v = vbar.alloc(weight_size)
|
weight._v = vbar.alloc(weight_size)
|
||||||
weight._v_tensor = comfy_aimdo.torch.aimdo_to_tensor(weight._v, device_to)
|
|
||||||
weight._model_dtype = model_dtype
|
weight._model_dtype = model_dtype
|
||||||
allocated_size += weight_size
|
allocated_size += weight_size
|
||||||
vbar.set_watermark_limit(allocated_size)
|
vbar.set_watermark_limit(allocated_size)
|
||||||
|
|||||||
@ -87,7 +87,7 @@ def cast_bias_weight_with_vbar(s, dtype, device, bias_dtype, non_blocking, compu
|
|||||||
|
|
||||||
signature = comfy_aimdo.model_vbar.vbar_fault(s._v)
|
signature = comfy_aimdo.model_vbar.vbar_fault(s._v)
|
||||||
if signature is not None:
|
if signature is not None:
|
||||||
xfer_dest = s._v_tensor
|
xfer_dest = comfy_aimdo.torch.aimdo_to_tensor(s._v, device)
|
||||||
resident = comfy_aimdo.model_vbar.vbar_signature_compare(signature, s._v_signature)
|
resident = comfy_aimdo.model_vbar.vbar_signature_compare(signature, s._v_signature)
|
||||||
|
|
||||||
if not resident:
|
if not resident:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user