Skip to content

Commit 661d54d

Browse files
committed
bug fix
1 parent 4b1b8cd commit 661d54d

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

autointent/_dump_tools/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
class BaseObjectDumper(ABC, Generic[T]):
3232
dir_or_file_name: str
3333

34-
@abstractmethod
3534
@staticmethod
35+
@abstractmethod
3636
def dump(obj: T, path: Path, exists_ok: bool) -> None: ...
3737

38-
@abstractmethod
3938
@staticmethod
39+
@abstractmethod
4040
def load(path: Path, **kwargs: Any) -> T: ... # noqa: ANN401
4141

42-
@abstractmethod
4342
@classmethod
43+
@abstractmethod
4444
def check_isinstance(cls, obj: Any) -> bool: ... # noqa: ANN401

autointent/_dump_tools/main.py

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

88
from autointent.configs import CrossEncoderConfig, EmbedderConfig
99
from autointent.context.optimization_info import Artifact
10+
from autointent.schemas import TagsList
1011

1112
from .base import BaseObjectDumper, ModuleAttributes, ModuleSimpleAttributes
1213
from .unit_dumpers import (
@@ -101,7 +102,7 @@ def dump(
101102
continue
102103

103104
# Handle simple attributes and arrays separately
104-
if isinstance(val, ModuleSimpleAttributes):
105+
if isinstance(val, ModuleSimpleAttributes) and not isinstance(val, TagsList):
105106
simple_attrs[key] = val
106107
elif isinstance(val, np.ndarray):
107108
arrays[key] = val

autointent/_dump_tools/unit_dumpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ class EstimatorDumper(BaseObjectDumper[BaseEstimator]):
120120
dir_or_file_name = "estimators"
121121

122122
@staticmethod
123-
def dump(obj: BaseEstimator, path: Path, exists_ok: bool) -> None: # noqa: ARG004
123+
def dump(obj: BaseEstimator, path: Path, exists_ok: bool) -> None:
124+
path.parent.mkdir(parents=True, exist_ok=exists_ok)
124125
joblib.dump(obj, path)
125126

126127
@staticmethod

autointent/schemas/_schemas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(self, tags: list[Tag]) -> None:
3131
super().__init__(tags)
3232

3333
def dump(self, path: Path) -> None:
34+
path.parent.mkdir(parents=True, exist_ok=True)
3435
serialized = [v.model_dump(mode="json") for v in self]
3536
with path.open("w", encoding="utf-8") as file:
3637
json.dump(serialized, file, indent=4, ensure_ascii=False)

0 commit comments

Comments
 (0)