MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / state_dicts_almost_equal

Function state_dicts_almost_equal

diffusers/tests/lora/utils.py:47–56  ·  view source on GitHub ↗
(sd1, sd2)

Source from the content-addressed store, hash-verified

45
46
47def state_dicts_almost_equal(sd1, sd2):
48 sd1 = dict(sorted(sd1.items()))
49 sd2 = dict(sorted(sd2.items()))
50
51 models_are_equal = True
52 for ten1, ten2 in zip(sd1.values(), sd2.values()):
53 if (ten1 - ten2).abs().max() > 1e-3:
54 models_are_equal = False
55
56 return models_are_equal
57
58
59def check_if_lora_correctly_set(model) -> bool:

Callers 1

Calls

no outgoing calls

Tested by 1