Skip to content

Commit

Permalink
hydra/OC.structured: don't hide error
Browse files Browse the repository at this point in the history
Summary: Keep the cause of hydra errors visible in some more cases.

Reviewed By: shapovalov

Differential Revision: D40516202

fbshipit-source-id: 8d214be5cc808a37738add77cc305fe099788546
  • Loading branch information
bottler authored and facebook-github-bot committed Oct 20, 2022
1 parent 9535c57 commit 8339cf2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pytorch3d/implicitron/tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,12 @@ def get_default_args(C, *, _do_not_process: Tuple[type, ...] = ()) -> DictConfig

try:
out: DictConfig = OmegaConf.structured(C)
except Exception as e:
raise ValueError(f"OmegaConf.structured({C}) failed") from e
except Exception:
print(f"### OmegaConf.structured({C}) failed ###")
# We don't use `raise From` here, because that gets the original
# exception hidden by the OC_CAUSE logic in the case where we are
# called by hydra.
raise
exclude = getattr(C, "_processed_members", ())
with open_dict(out):
for field in exclude:
Expand All @@ -545,8 +549,9 @@ def get_default_args(C, *, _do_not_process: Tuple[type, ...] = ()) -> DictConfig

try:
out: DictConfig = OmegaConf.structured(dataclass)
except Exception as e:
raise ValueError(f"OmegaConf.structured failed for {dataclass_name}") from e
except Exception:
print(f"### OmegaConf.structured failed for {C.__name__} ###")
raise
return out


Expand Down

0 comments on commit 8339cf2

Please sign in to comment.