BootsofLagrangian commited on
Commit
cc3da9e
·
verified ·
1 Parent(s): 77cd05d

Upload OrthoViTForImageClassification

Browse files
Files changed (2) hide show
  1. model.safetensors +1 -1
  2. 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:a0d99e8aebb9719333f101b00f1110d881d3e084c80afbf8ca96c45891449b0a
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 user'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 user'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
- # 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