Update save.py
This commit is contained in:
parent
03ed3a83d5
commit
33192d6dc8
1 changed files with 6 additions and 2 deletions
|
|
@ -102,8 +102,12 @@ def _merge_lora(layer, name, max_vram):
|
|||
pass
|
||||
W.addmm_(A.t().to(torch.float32), B.t().to(torch.float32), alpha = s)
|
||||
# if not torch.isfinite(W).all():
|
||||
if not torch.isfinite(torch.max(W.min().abs(), W.max())).item():
|
||||
raise ValueError(f"Unsloth: Merge failed.\n{name} has some elements = infinity.")
|
||||
maximum_element = torch.max(W.min().abs(), W.max())
|
||||
if not torch.isfinite(maximum_element).item():
|
||||
raise ValueError(
|
||||
f"Unsloth: Merge failed.\n{name} has some elements = infinity.\n"\
|
||||
f"For example the element {maximum_element.item()}"
|
||||
)
|
||||
pass
|
||||
W = W.t().to(dtype)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue