iterative / dvclive

📈 Log and track ML metrics, parameters, models with Git and/or DVC
https://dvc.org/doc/dvclive
Apache License 2.0
161 stars 35 forks source link

log_params: fix invalid type msg #745

Closed dberenbaum closed 9 months ago

dberenbaum commented 9 months ago

Before this PR, when logging an invalid parameter type, you would always get a generic error message that doesn't reflect the actual type passed:

>>> Live().log_param("p", pd.DataFrame())
...
dvclive.error.InvalidParameterTypeError: Parameter type <class 'tuple'> is not supported.

With this PR, you get info about the actual invalid type passed:

>>> Live().log_param("p", pd.DataFrame())
...
dvclive.error.InvalidParameterTypeError: cannot represent an object: Empty DataFrame

This happens because log_params dumps a dict to yaml and the error comes from failing to write to yaml. Unfortunately, I don't see an easy way to parse the error output to get more control over the message.

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (f39c7e2) 88.79% compared to head (06feff9) 88.79%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #745 +/- ## ======================================= Coverage 88.79% 88.79% ======================================= Files 53 53 Lines 3357 3357 Branches 294 294 ======================================= Hits 2981 2981 Misses 337 337 Partials 39 39 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.