Thastp commited on
Commit
44aa62f
·
verified ·
1 Parent(s): 60339fa

Upload model

Browse files
config.json CHANGED
@@ -1,12 +1,10 @@
1
  {
2
- "_name_or_path": "./efficientnet/temp",
3
  "architectures": [
4
- "EfficientNetModelForImageClassification"
5
  ],
6
  "auto_map": {
7
  "AutoConfig": "configuration_efficientnet.EfficientNetConfig",
8
- "AutoModel": "modeling_efficientnet.EfficientNetModel",
9
- "AutoModelForImageClassification": "modeling_efficientnet.EfficientNetModelForImageClassification"
10
  },
11
  "model_name": "efficientnet_b0",
12
  "model_type": "efficientnet",
 
1
  {
 
2
  "architectures": [
3
+ "EfficientNetModel"
4
  ],
5
  "auto_map": {
6
  "AutoConfig": "configuration_efficientnet.EfficientNetConfig",
7
+ "AutoModel": "modeling_efficientnet.EfficientNetModel"
 
8
  },
9
  "model_name": "efficientnet_b0",
10
  "model_type": "efficientnet",
configuration_efficientnet.py CHANGED
@@ -34,19 +34,78 @@ class EfficientNetConfig(PretrainedConfig):
34
 
35
  self.model_name = model_name
36
  self.pretrained = pretrained
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  super().__init__(**kwargs)
39
 
40
  class EfficientNetOnnxConfig(ViTOnnxConfig):
41
-
42
  @property
43
  def outputs(self) -> Dict[str, Dict[int, str]]:
44
  common_outputs = super().outputs
45
 
46
  if self.task == "image-classification":
47
  common_outputs["logits"] = {0: "batch_size", 1: "num_classes"}
48
- elif self.task == "feature-extraction":
49
- common_outputs["last_hidden_state"] = {0: "batch_size", 1: "num_features", 2: "height", 3: "width"}
50
 
51
  return common_outputs
52
 
 
34
 
35
  self.model_name = model_name
36
  self.pretrained = pretrained
37
+
38
+ # add attributes
39
+ # "batch_norm_eps": 0.001,
40
+ # "batch_norm_momentum": 0.99,
41
+ # "depth_coefficient": 3.1,
42
+ # "depth_divisor": 8,
43
+ # "depthwise_padding": [],
44
+ # "drop_connect_rate": 0.2,
45
+ # "dropout_rate": 0.5,
46
+ # "expand_ratios": [
47
+ # 1,
48
+ # 6,
49
+ # 6
50
+ # ],
51
+ # "hidden_act": "gelu",
52
+ # "hidden_dim": 2560,
53
+ # "id2label": { IMAGE NET DATASET
54
+ # "0": "LABEL_0",
55
+ # "1": "LABEL_1",
56
+ # "2": "LABEL_2",
57
+ # ...
58
+ # },
59
+ # "image_size": 600,
60
+ # "in_channels": [
61
+ # 32,
62
+ # 16,
63
+ # 24
64
+ # ],
65
+ # "initializer_range": 0.02,
66
+ # "kernel_sizes": [
67
+ # 3,
68
+ # 3,
69
+ # 5
70
+ # ],
71
+ # "label2id": {
72
+ # "LABEL_0": 0,
73
+ # "LABEL_1": 1,
74
+ # "LABEL_2": 2,
75
+ # ...
76
+ # },
77
+ # "model_type": "efficientnet",
78
+ # "num_block_repeats": [
79
+ # 1,
80
+ # 1,
81
+ # 2
82
+ # ],
83
+ # "num_channels": 3,
84
+ # "num_hidden_layers": 16,
85
+ # "out_channels": [
86
+ # 16,
87
+ # 24,
88
+ # 40
89
+ # ],
90
+ # "pooling_type": "mean",
91
+ # "squeeze_expansion_ratio": 0.25,
92
+ # "strides": [
93
+ # 1,
94
+ # 1,
95
+ # 2
96
+ # ],
97
+ # "width_coefficient": 2.0
98
+ # }
99
 
100
  super().__init__(**kwargs)
101
 
102
  class EfficientNetOnnxConfig(ViTOnnxConfig):
 
103
  @property
104
  def outputs(self) -> Dict[str, Dict[int, str]]:
105
  common_outputs = super().outputs
106
 
107
  if self.task == "image-classification":
108
  common_outputs["logits"] = {0: "batch_size", 1: "num_classes"}
 
 
109
 
110
  return common_outputs
111
 
modeling_efficientnet.py CHANGED
@@ -13,6 +13,7 @@ class EfficientNetModel(PreTrainedModel):
13
  def __init__(self, config):
14
  super().__init__(config)
15
 
 
16
  self.model = create_model(config.model_name, pretrained = config.pretrained)
17
 
18
  def forward(self, pixel_values):
@@ -27,6 +28,7 @@ class EfficientNetModelForImageClassification(PreTrainedModel):
27
  def __init__(self, config):
28
  super().__init__(config)
29
 
 
30
  self.model = create_model(config.model_name, pretrained = config.pretrained)
31
 
32
  def forward(self, pixel_values, labels=None):
 
13
  def __init__(self, config):
14
  super().__init__(config)
15
 
16
+ self.config = config
17
  self.model = create_model(config.model_name, pretrained = config.pretrained)
18
 
19
  def forward(self, pixel_values):
 
28
  def __init__(self, config):
29
  super().__init__(config)
30
 
31
+ self.config = config
32
  self.model = create_model(config.model_name, pretrained = config.pretrained)
33
 
34
  def forward(self, pixel_values, labels=None):