Upload OrthoViTForImageClassification
Browse files- model.safetensors +1 -1
- modeling_ortho_vit.py +2 -3
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 346141064
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9a9735341b0c6e7e502b992b918dee50943a643182913e280e5d0308beda20e9
|
3 |
size 346141064
|
modeling_ortho_vit.py
CHANGED
@@ -379,12 +379,11 @@ class OrthoViTForImageClassification(OrthoViTPreTrainedModel):
|
|
379 |
self.vit = OrthoViTModel(config, add_pooling_layer=False) # Use OrthoViTModel
|
380 |
|
381 |
# Classifier head (standard HF: just a Linear layer)
|
382 |
-
# The
|
383 |
# The OrthoViTModel's output (CLS token) is already layernormed by self.vit.layernorm.
|
384 |
-
# So, if that self.vit.layernorm corresponds to the
|
385 |
# then this classifier head should just be Linear.
|
386 |
# If an *additional* LN is needed on the CLS token, this needs to be nn.Sequential.
|
387 |
-
# For now, assume vit.layernorm covers the user's classifier.0.
|
388 |
self.classifier = nn.Linear(config.hidden_size, config.num_labels) if config.num_labels > 0 else nn.Identity()
|
389 |
|
390 |
# Initialize weights and apply final processing
|
|
|
379 |
self.vit = OrthoViTModel(config, add_pooling_layer=False) # Use OrthoViTModel
|
380 |
|
381 |
# Classifier head (standard HF: just a Linear layer)
|
382 |
+
# The author's original classifier was nn.Sequential(nn.LayerNorm(dim), nn.Linear(dim, num_classes))
|
383 |
# The OrthoViTModel's output (CLS token) is already layernormed by self.vit.layernorm.
|
384 |
+
# So, if that self.vit.layernorm corresponds to the author's classifier.0 (LayerNorm),
|
385 |
# then this classifier head should just be Linear.
|
386 |
# If an *additional* LN is needed on the CLS token, this needs to be nn.Sequential.
|
|
|
387 |
self.classifier = nn.Linear(config.hidden_size, config.num_labels) if config.num_labels > 0 else nn.Identity()
|
388 |
|
389 |
# Initialize weights and apply final processing
|