Browse Source

Use function to calculate model size in model patcher.

pull/1572/merge
comfyanonymous 11 months ago
parent
commit
12e822c6c8
  1. 8
      comfy/model_patcher.py

8
comfy/model_patcher.py

@ -28,13 +28,9 @@ class ModelPatcher:
if self.size > 0:
return self.size
model_sd = self.model.state_dict()
size = 0
for k in model_sd:
t = model_sd[k]
size += t.nelement() * t.element_size()
self.size = size
self.size = comfy.model_management.module_size(self.model)
self.model_keys = set(model_sd.keys())
return size
return self.size
def clone(self):
n = ModelPatcher(self.model, self.load_device, self.offload_device, self.size, self.current_device, weight_inplace_update=self.weight_inplace_update)

Loading…
Cancel
Save