Skip to content

Commit e015d7c

Browse files
fix: bug fix for precision parameter for patchcore and anomalydino
1 parent 59d268c commit e015d7c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/anomalib/models/image/anomaly_dino/lightning_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ class AnomalyDINO(MemoryBankMixin, AnomalibModule):
9090
to reduce the size of the memory bank. Defaults to ``False``.
9191
sampling_ratio (float, optional): If coreset subsampling, by what ratio
9292
should we subsample. Defaults to ``0.1``
93-
precision (str, optional): Precision type for model computations.
94-
Supported values are defined in :class:`PrecisionType`.
95-
Defaults to ``PrecisionType.FLOAT32``.
93+
precision (str | PrecisionType, optional): Precision type for model computations.
94+
Can be either a string (``"float32"``, ``"float16"``) or a :class:`PrecisionType` enum value.
95+
Defaults to ``"float32"``.
9696
pre_processor (PreProcessor | bool, optional): Pre-processor instance or
9797
bool flag to enable default preprocessing. Defaults to ``True``.
9898
post_processor (PostProcessor | bool, optional): Post-processor instance or
@@ -154,7 +154,7 @@ def __init__(
154154
masking: bool = False,
155155
coreset_subsampling: bool = False,
156156
sampling_ratio: float = 0.1,
157-
precision: str = PrecisionType.FLOAT32,
157+
precision: str | PrecisionType = PrecisionType.FLOAT32.value,
158158
pre_processor: nn.Module | bool = True,
159159
post_processor: nn.Module | bool = True,
160160
evaluator: Evaluator | bool = True,

src/anomalib/models/image/patchcore/lightning_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ class Patchcore(MemoryBankMixin, AnomalibModule):
9393
subsample embeddings. Defaults to ``0.1``.
9494
num_neighbors (int, optional): Number of nearest neighbors to use.
9595
Defaults to ``9``.
96-
precision (str, optional): Precision type for model computations.
97-
Supported values are defined in :class:`PrecisionType`.
98-
Defaults to ``PrecisionType.FLOAT32``.
96+
precision (str | PrecisionType, optional): Precision type for model computations.
97+
Can be either a string (``"float32"``, ``"float16"``) or a :class:`PrecisionType` enum value.
98+
Defaults to ``"float32"``.
9999
pre_processor (PreProcessor | bool, optional): Pre-processor instance or
100100
bool flag. Defaults to ``True``.
101101
post_processor (PostProcessor | bool, optional): Post-processor instance or
@@ -145,7 +145,7 @@ def __init__(
145145
pre_trained: bool = True,
146146
coreset_sampling_ratio: float = 0.1,
147147
num_neighbors: int = 9,
148-
precision: str = PrecisionType.FLOAT32,
148+
precision: str | PrecisionType = PrecisionType.FLOAT32.value,
149149
pre_processor: nn.Module | bool = True,
150150
post_processor: nn.Module | bool = True,
151151
evaluator: Evaluator | bool = True,

0 commit comments

Comments
 (0)