Skip to content

Commit 52f14f0

Browse files
committed
np encoder
1 parent e13ab64 commit 52f14f0

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

autointent/_dump_tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from autointent import Embedder, Ranker, VectorIndex
1515
from autointent.configs import CrossEncoderConfig, EmbedderConfig
16+
from autointent.context._utils import NumpyEncoder
1617
from autointent.schemas import TagsList
1718

1819
ModuleSimpleAttributes = None | str | int | float | bool | list # type: ignore[type-arg]
@@ -85,7 +86,7 @@ def dump(obj: Any, path: Path) -> None: # noqa: ANN401, C901
8586
try:
8687
pydantic_path = path / Dumper.pydantic_models / f"{key}.json"
8788
with pydantic_path.open("w", encoding="utf-8") as file:
88-
json.dump(val.model_dump(), file, ensure_ascii=False, indent=4)
89+
json.dump(val.model_dump(), file, ensure_ascii=False, indent=4, cls=NumpyEncoder)
8990
except Exception as e:
9091
msg = f"Error dumping pydantic model {key}: {e}"
9192
logging.exception(msg)

0 commit comments

Comments
 (0)