Skip to content

Commit

Permalink
Improve error message for assertion on replicated entries (#164)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #164

As title, report the mismatched paths in the error message to make it easier to debug

Reviewed By: RdoubleA, williamhufb

Differential Revision: D50896542

fbshipit-source-id: cc9d69c13c2313490b65bc4d30752a7e1c399ea9
  • Loading branch information
ananthsub authored and facebook-github-bot committed Nov 2, 2023
1 parent 4cc90fe commit c6b5bc5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion torchsnapshot/partitioner.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ def consolidate_replicated_entries(
if not is_fully_replicated_entry(entry):
continue
if logical_path in replicated_entries:
assert replicated_entries[logical_path] == entry
if replicated_entries[logical_path] != entry:
raise ValueError(
f"Paths for replicated entry do not match: replicated entries={replicated_entries[logical_path]} vs. entry={entry}"
)
else:
replicated_entries[logical_path] = entry
del entries[logical_path]
Expand Down

0 comments on commit c6b5bc5

Please sign in to comment.