Skip to content

Commit

Permalink
support empty kwargs
Browse files Browse the repository at this point in the history
Signed-off-by: sichu <[email protected]>
  • Loading branch information
sichu2023 committed Feb 5, 2025
1 parent 21a1e40 commit c43eff6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sub-packages/bionemo-llm/src/bionemo/llm/model/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,14 @@ class MetricConfig:
"""

class_path: str
kwargs: dict[str, Any]
kwargs: Optional[dict[str, Any]] = None
metric_name: Optional[str] = None

def __post_init__(self):
"""__post_init__ in dataclass."""
super().__post_init__()
self.kwargs = {} if self.kwargs is None else self.kwargs

def get_instance(self) -> torchmetrics.Metric:
"""Dynamically imports and instantiates the metric class."""
module_path, class_name = self.class_path.rsplit(".", 1)
Expand Down

0 comments on commit c43eff6

Please sign in to comment.