Skip to content

Commit

Permalink
setting checkpoint delta error to 0.1 for now as well as verbose
Browse files Browse the repository at this point in the history
printing of delta
  • Loading branch information
brandon-edwards committed Oct 8, 2024
1 parent e65eeef commit aaf61fa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/fl_post/fl/project/src/runner_nnunetv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,12 @@ def validate(self, col_name, round_num, input_tensor_dict, from_checkpoint=False
# TODO: Figure out the right name to use for this method and the default assigner
"""Perform validation."""

def compare_tensor_dicts(td_1, td_2, tag="", epsilon=0.0001):
def compare_tensor_dicts(td_1, td_2, tag="", epsilon=0.1, verbose=True):
hash_1 = np.sum([np.mean(np.array(_value)) for _value in td_1.values()])
hash_2 = np.sum([np.mean(np.array(_value)) for _value in td_2.values()])
delta = np.abs(hash_1 - hash_2)
if verbose:
print(f"The tensor dict comparison {tag} resulted in delta: {delta} (accepted error: {epsilon}).")
if delta > epsilon:
raise ValueError(f"The tensor dict comparison {tag} failed with delta: {delta} against an accepted error of: {epsilon}.")

Expand Down

0 comments on commit aaf61fa

Please sign in to comment.