MCPcopy Create free account
hub / github.com/VisionXLab/OF-Diff / compare_weights

Function compare_weights

cldm/model.py:47–62  ·  view source on GitHub ↗
(state_dict, layer1_name, layer2_name)

Source from the content-addressed store, hash-verified

45 return model
46
47def compare_weights(state_dict, layer1_name, layer2_name):
48 if layer1_name not in state_dict:
49 print(f"Layer {layer1_name} not found!")
50 return False
51 if layer2_name not in state_dict:
52 print(f"Layer {layer2_name} not found!")
53 return False
54 weight1 = state_dict[layer1_name]
55 weight2 = state_dict[layer2_name]
56
57 are_equal = torch.equal(weight1, weight2)
58 if are_equal:
59 print(f"The weights are identical!")
60 else:
61 print(f"The weights are different!")
62 return are_equal

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected