Upload model
Browse files- config.json +1 -0
- model.safetensors +2 -2
- modeling_davit.py +6 -6
config.json
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
{
|
|
|
2 |
"architectures": [
|
3 |
"DaViTModel"
|
4 |
],
|
|
|
1 |
{
|
2 |
+
"_name_or_path": "/Users/andrewmayes/Dev/DaViT/models--amaye15--DaViT-Florence-2-large-ft/snapshots/4cc7068026aaeb388ba2b0826abae30d670de3fc",
|
3 |
"architectures": [
|
4 |
"DaViTModel"
|
5 |
],
|
model.safetensors
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a9e5478c88ead1963dca36b397c923b5e8c0a0c9897e94fff90c015f949fe4a4
|
3 |
+
size 721319376
|
modeling_davit.py
CHANGED
@@ -597,11 +597,11 @@ class DaViTModel(PreTrainedModel):
|
|
597 |
self.convs = nn.ModuleList(convs)
|
598 |
self.blocks = nn.ModuleList(blocks)
|
599 |
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
self.avgpool = nn.AdaptiveAvgPool1d(1)
|
606 |
# self.head = (
|
607 |
# nn.Linear(self.embed_dims[-1], self.num_classes)
|
@@ -650,7 +650,7 @@ class DaViTModel(PreTrainedModel):
|
|
650 |
x = self.avgpool(x.transpose(1, 2))
|
651 |
# (batch_size, 1, num_tokens)
|
652 |
x = torch.flatten(x, 1)
|
653 |
-
|
654 |
|
655 |
return x
|
656 |
|
|
|
597 |
self.convs = nn.ModuleList(convs)
|
598 |
self.blocks = nn.ModuleList(blocks)
|
599 |
|
600 |
+
self.norms = (
|
601 |
+
nn.LayerNorm(self.embed_dims[-1])
|
602 |
+
if config.norm_layer == "layer_norm"
|
603 |
+
else nn.BatchNorm2d(self.embed_dims[-1])
|
604 |
+
)
|
605 |
self.avgpool = nn.AdaptiveAvgPool1d(1)
|
606 |
# self.head = (
|
607 |
# nn.Linear(self.embed_dims[-1], self.num_classes)
|
|
|
650 |
x = self.avgpool(x.transpose(1, 2))
|
651 |
# (batch_size, 1, num_tokens)
|
652 |
x = torch.flatten(x, 1)
|
653 |
+
x = self.norms(x)
|
654 |
|
655 |
return x
|
656 |
|