Skip to content

Commit 6715f54

Browse files
fix(model): resolve copilot comments
1 parent b35e3c4 commit 6715f54

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

src/anomalib/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ class UnknownModelError(ModuleNotFoundError):
104104
"Csflow",
105105
"Dfkde",
106106
"Dfm",
107-
"Draem",
108107
"Dinomaly",
108+
"Draem",
109109
"Dsr",
110110
"EfficientAd",
111111
"Fastflow",

src/anomalib/models/components/dinov2/layers/dino_head.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def _build_mlp(
104104
if nlayers == 1:
105105
return nn.Linear(in_dim, bottleneck_dim, bias=bias)
106106

107-
assert hidden_dim is not None, "hidden_dim must be provided when nlayers > 1"
107+
assert hidden_dim is not None, f"hidden_dim must be provided when nlayers ({nlayers}) > 1"
108108

109109
layers: list[nn.Module] = [
110110
nn.Linear(in_dim, hidden_dim, bias=bias),

src/anomalib/models/components/dinov2/layers/patch_embed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def make_2tuple(x: int | tuple[int, int]) -> tuple[int, int]:
2727
A tuple ``(h, w)``.
2828
"""
2929
if isinstance(x, tuple):
30-
assert len(x) == 2
30+
assert len(x) == 2, f"Expected tuple of length 2, got {len(x)}"
3131
return x
3232
return (x, x)
3333

src/anomalib/models/components/dinov2/vision_transformer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def interpolate_pos_encoding(
253253
w0 = w // self.patch_size
254254
h0 = h // self.patch_size
255255
m = int(math.sqrt(n_pos))
256-
assert n_pos == m * m
256+
assert n_pos == m * m, f"Expected {m * m} positional embeddings but got {n_pos}"
257257

258258
kwargs: dict[str, object] = {}
259259
if self.interpolate_offset:

src/anomalib/models/image/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
"Cflow",
7777
"Csflow",
7878
"Dfkde",
79-
"Dinomaly",
8079
"Dfm",
80+
"Dinomaly",
8181
"Draem",
8282
"Dsr",
8383
"EfficientAd",

0 commit comments

Comments
 (0)