Skip to content

Commit

Permalink
remove omegaconf
Browse files Browse the repository at this point in the history
  • Loading branch information
voorhs committed Jan 16, 2025
1 parent 683538f commit 7f04bef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 3 additions & 6 deletions autointent/context/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@
from typing import Any

import numpy as np
from omegaconf import ListConfig

from autointent import Dataset


class NumpyEncoder(json.JSONEncoder):
"""
JSON encoder that handles numpy data types and OmegaConf ListConfig.
JSON encoder that handles numpy data types.
This encoder extends the default `json.JSONEncoder` to serialize numpy
arrays, numpy data types, and OmegaConf ListConfig objects.
arrays, numpy data types.
"""

def default(self, obj: Any) -> str | int | float | list[Any] | Any: # noqa: ANN401
"""
Serialize objects with special handling for numpy and OmegaConf types.
Serialize objects with special handling for numpy.
:param obj: Object to serialize.
:return: JSON-serializable representation of the object.
Expand All @@ -35,8 +34,6 @@ def default(self, obj: Any) -> str | int | float | list[Any] | Any: # noqa: ANN
return float(obj)
if isinstance(obj, np.ndarray):
return obj.tolist()
if isinstance(obj, ListConfig):
return list(obj)
return super().default(obj)


Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ module = [
"appdirs",
"sre_yield",
"skmultilearn.model_selection",
"omegaconf",
"hydra",
"hydra.*",
"transformers",
Expand Down

0 comments on commit 7f04bef

Please sign in to comment.