Model unchanged.
Browse filesThis is commit description!
- config.json +4 -4
- configuration_resnet.py +2 -2
- modeling_resnet.py +5 -5
config.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
-
"
|
| 4 |
],
|
| 5 |
"auto_map": {
|
| 6 |
-
"AutoConfig": "configuration_resnet.
|
| 7 |
-
"AutoModelForImageClassification": "modeling_resnet.
|
| 8 |
},
|
| 9 |
"avg_down": true,
|
| 10 |
"base_width": 64,
|
|
@@ -17,7 +17,7 @@
|
|
| 17 |
6,
|
| 18 |
3
|
| 19 |
],
|
| 20 |
-
"model_type": "
|
| 21 |
"num_classes": 1000,
|
| 22 |
"stem_type": "deep",
|
| 23 |
"stem_width": 32,
|
|
|
|
| 1 |
{
|
| 2 |
"architectures": [
|
| 3 |
+
"MyResnetModelForImageClassification"
|
| 4 |
],
|
| 5 |
"auto_map": {
|
| 6 |
+
"AutoConfig": "configuration_resnet.MyResnetConfig",
|
| 7 |
+
"AutoModelForImageClassification": "modeling_resnet.MyResnetModelForImageClassification"
|
| 8 |
},
|
| 9 |
"avg_down": true,
|
| 10 |
"base_width": 64,
|
|
|
|
| 17 |
6,
|
| 18 |
3
|
| 19 |
],
|
| 20 |
+
"model_type": "MyResnet",
|
| 21 |
"num_classes": 1000,
|
| 22 |
"stem_type": "deep",
|
| 23 |
"stem_width": 32,
|
configuration_resnet.py
CHANGED
|
@@ -2,8 +2,8 @@ from transformers import PretrainedConfig
|
|
| 2 |
from typing import List
|
| 3 |
|
| 4 |
|
| 5 |
-
class
|
| 6 |
-
model_type = "
|
| 7 |
|
| 8 |
def __init__(
|
| 9 |
self,
|
|
|
|
| 2 |
from typing import List
|
| 3 |
|
| 4 |
|
| 5 |
+
class MyResnetConfig(PretrainedConfig):
|
| 6 |
+
model_type = "MyResnet"
|
| 7 |
|
| 8 |
def __init__(
|
| 9 |
self,
|
modeling_resnet.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
from transformers import PreTrainedModel
|
| 2 |
from timm.models.resnet import BasicBlock, Bottleneck, ResNet
|
| 3 |
-
from .configuration_resnet import
|
| 4 |
import torch
|
| 5 |
|
| 6 |
BLOCK_MAPPING = {"basic": BasicBlock, "bottleneck": Bottleneck}
|
| 7 |
|
| 8 |
|
| 9 |
-
class
|
| 10 |
-
config_class =
|
| 11 |
|
| 12 |
def __init__(self, config):
|
| 13 |
super().__init__(config)
|
|
@@ -28,8 +28,8 @@ class ResnetModel(PreTrainedModel):
|
|
| 28 |
return self.model.forward_features(tensor)
|
| 29 |
|
| 30 |
|
| 31 |
-
class
|
| 32 |
-
config_class =
|
| 33 |
|
| 34 |
def __init__(self, config):
|
| 35 |
super().__init__(config)
|
|
|
|
| 1 |
from transformers import PreTrainedModel
|
| 2 |
from timm.models.resnet import BasicBlock, Bottleneck, ResNet
|
| 3 |
+
from .configuration_resnet import MyResnetConfig
|
| 4 |
import torch
|
| 5 |
|
| 6 |
BLOCK_MAPPING = {"basic": BasicBlock, "bottleneck": Bottleneck}
|
| 7 |
|
| 8 |
|
| 9 |
+
class MyResnetModel(PreTrainedModel):
|
| 10 |
+
config_class = MyResnetConfig
|
| 11 |
|
| 12 |
def __init__(self, config):
|
| 13 |
super().__init__(config)
|
|
|
|
| 28 |
return self.model.forward_features(tensor)
|
| 29 |
|
| 30 |
|
| 31 |
+
class MyResnetModelForImageClassification(PreTrainedModel):
|
| 32 |
+
config_class = MyResnetConfig
|
| 33 |
|
| 34 |
def __init__(self, config):
|
| 35 |
super().__init__(config)
|