Upload 2 files
Browse files- convert.py +15 -0
- dinov2_vits14.safetensors +3 -0
convert.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from safetensors.torch import save_file
|
3 |
+
|
4 |
+
# def normalize_key(k):
|
5 |
+
# if k.startswith("backbone."):
|
6 |
+
# k = k[9:]
|
7 |
+
# if k.startswith("linear_head."):
|
8 |
+
# k = k[7:]
|
9 |
+
# return k
|
10 |
+
|
11 |
+
dinov2_vits14 = torch.hub.load('facebookresearch/dinov2', 'dinov2_vits14')
|
12 |
+
print(dinov2_vits14)
|
13 |
+
weights = dinov2_vits14.state_dict()
|
14 |
+
# weights = {normalize_key(k): v for k, v in weights.items()}
|
15 |
+
save_file(weights, "dinov2_vits14.safetensors")
|
dinov2_vits14.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c505d4d9a67c4104ba8b78420c4c290d2b6819f4ead80fadcd0715f0b9dff75e
|
3 |
+
size 88242128
|