Skip to content

Commit 91f7091

Browse files
committed
Raise RuntimeError for unexpected exceptions when dumping hparams to YAML
1 parent 6a5c946 commit 91f7091

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lightning/pytorch/core/saving.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ def save_hparams_to_yaml(config_yaml: _PATH, hparams: Union[dict, Namespace], us
362362
except (TypeError, ValueError):
363363
warn(f"Skipping '{k}' parameter because it is not possible to safely dump to YAML.")
364364
hparams[k] = type(v).__name__
365+
except Exception as e:
366+
raise RuntimeError(
367+
f"Unexpected error while dumping hyperparameter '{k}' (value: {v!r}) to YAML. Please report this issue."
368+
) from e
365369
else:
366370
hparams_allowed[k] = v
367371

0 commit comments

Comments
 (0)