Skip to content

Commit

Permalink
Fix pretty_print in inspect_checkpoints.py
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelion-source committed Mar 10, 2025
1 parent 62aded2 commit ac86005
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/ckpts/inspect_checkpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def pretty_print(contents: dict):
key_length = len(str(k))
line = " " * (col_size - key_length)
line += f"{k}: {COLORS.BLUE}{type(v).__name__}{COLORS.END}"
if isinstance(v, dict):
if isinstance(v, dict) and v:
pretty_print(v)
elif isinstance(v, PRIMITIVE_TYPES):
line += f" = "
Expand Down Expand Up @@ -120,7 +120,7 @@ def pretty_print_double(contents1: dict, contents2: dict, args):
continue
else:
prefix = f"{k}: {COLORS.BLUE}{type(v1).__name__} | {type(v2).__name__}{COLORS.END}"
if isinstance(v1, dict):
if isinstance(v1, dict) and v1 and v2:
pretty_print_double(v1, v2, args)
elif isinstance(v1, PRIMITIVE_TYPES):
if repr(v1) != repr(v2):
Expand Down

0 comments on commit ac86005

Please sign in to comment.