in ablations/training/launch_exp.py [0:0]
def print_differences(target, updates):
if not is_dataclass(target) or not is_dataclass(updates):
raise ValueError("Both target and updates should be dataclass instances")
for field in fields(target):
update_value = getattr(updates, field.name)
if update_value is not None:
if is_dataclass(update_value):
print_differences(getattr(target, field.name), update_value)
else:
target_value = getattr(target, field.name)
if update_value != target_value:
if update_value.__class__.__module__ != "builtins":
continue
print(f"{field.name}: {target_value} -> {update_value}")