Add ResNet-18 on CIFAR-10 & Rename files
Browse files- cifar10-resnet18/cifar10-resnet18-0-1023.tgz +3 -0
- cifar10-resnet18/cifar10-resnet18-1024-2047.tgz +3 -0
- resnet20-frn-silu-cifar10/resnet20-frn-silu-cifar10-0-1023.tgz → cifar10-resnet20-frn-silu/cifar10-resnet20-frn-silu-0-1023.tgz +0 -0
- scripts/cifar-10-resnet18/std_loading.py +23 -0
- scripts/{resnet20-frn-silu-cifar10 → cifar10-resnet20-frn-silu}/std_loading.py +1 -1
cifar10-resnet18/cifar10-resnet18-0-1023.tgz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ec5bee33bfce177c77006126d0e03639bedc7bfd5a35b133f77c5645c0334cc1
|
3 |
+
size 22916280320
|
cifar10-resnet18/cifar10-resnet18-1024-2047.tgz
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:857fc51574cb31ab81dca2d45a845e85541a9dd2af0b53b08827313380234640
|
3 |
+
size 22916280320
|
resnet20-frn-silu-cifar10/resnet20-frn-silu-cifar10-0-1023.tgz → cifar10-resnet20-frn-silu/cifar10-resnet20-frn-silu-0-1023.tgz
RENAMED
File without changes
|
scripts/cifar-10-resnet18/std_loading.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pathlib import Path
|
2 |
+
|
3 |
+
from torch_uncertainty.models.resnet import resnet18
|
4 |
+
from safetensors.torch import load_file
|
5 |
+
|
6 |
+
|
7 |
+
def load_model(version: int):
|
8 |
+
"""Load the model corresponding to the given version."""
|
9 |
+
model = resnet18(
|
10 |
+
num_classes=10,
|
11 |
+
in_channels=3,
|
12 |
+
style="cifar",
|
13 |
+
conv_bias=False,
|
14 |
+
)
|
15 |
+
path = Path(
|
16 |
+
f"cifar10-resnet18/cifar10-resnet18-0-1023/version_{version}.safetensors"
|
17 |
+
)
|
18 |
+
if not path.exists():
|
19 |
+
raise ValueError("File does not exist")
|
20 |
+
|
21 |
+
state_dict = load_file(path)
|
22 |
+
model.load_state_dict(state_dict=state_dict)
|
23 |
+
return model
|
scripts/{resnet20-frn-silu-cifar10 → cifar10-resnet20-frn-silu}/std_loading.py
RENAMED
@@ -16,7 +16,7 @@ def load_model(version: int):
|
|
16 |
normalization_layer=FilterResponseNorm2d,
|
17 |
)
|
18 |
path = Path(
|
19 |
-
f"resnet20-frn-silu-
|
20 |
)
|
21 |
if not path.exists():
|
22 |
raise ValueError("File does not exist")
|
|
|
16 |
normalization_layer=FilterResponseNorm2d,
|
17 |
)
|
18 |
path = Path(
|
19 |
+
f"cifar10-resnet20-frn-silu/cifar10-resnet20-frn-silu-0-1023/version_{version}.safetensors"
|
20 |
)
|
21 |
if not path.exists():
|
22 |
raise ValueError("File does not exist")
|