Skip to content

Commit

Permalink
log_params: fix invalid type msg
Browse files Browse the repository at this point in the history
  • Loading branch information
dberenbaum committed Dec 1, 2023
1 parent 7d5c088 commit a7a30f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/dvclive/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ def __init__(self, name):


class InvalidParameterTypeError(DvcLiveError):
def __init__(self, val: Any):
self.val = val
super().__init__(f"Parameter type {type(val)} is not supported.")
def __init__(self, msg: Any):
super().__init__(msg)


class InvalidReportModeError(DvcLiveError):
Expand Down
2 changes: 1 addition & 1 deletion src/dvclive/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def _dump_params(self):
try:
dump_yaml(self._params, self.params_file)
except RepresenterError as exc:
raise InvalidParameterTypeError(exc.args) from exc
raise InvalidParameterTypeError(exc.args[0]) from exc

def log_params(self, params: Dict[str, ParamLike]):
"""Saves the given set of parameters (dict) to yaml"""
Expand Down
3 changes: 2 additions & 1 deletion tests/test_log_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ class Dummy:

param_value = Dummy()

with pytest.raises(InvalidParameterTypeError):
with pytest.raises(InvalidParameterTypeError) as excinfo:
dvclive.log_param("param_complex", param_value)
assert "Dummy" in excinfo.value.args[0]

0 comments on commit a7a30f8

Please sign in to comment.