added _init_weights
Browse files
model_utils/efficientnet_config.py
CHANGED
@@ -293,6 +293,20 @@ class EfficientNetConfig(PretrainedConfig):
|
|
293 |
|
294 |
super().__init__(**kwargs)
|
295 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
|
297 |
class EfficientNetPreTrained(PreTrainedModel):
|
298 |
|
|
|
293 |
|
294 |
super().__init__(**kwargs)
|
295 |
|
296 |
+
|
297 |
+
def _init_weights(self, module):
|
298 |
+
# initialize weights before loading
|
299 |
+
# not all will have weights and biases
|
300 |
+
try:
|
301 |
+
module.weight.data.normal_(mean=0.0)
|
302 |
+
except AttributeError:
|
303 |
+
_ = None
|
304 |
+
try:
|
305 |
+
module.bias.data.zero_()
|
306 |
+
except AttributeError:
|
307 |
+
_ = None
|
308 |
+
|
309 |
+
|
310 |
|
311 |
class EfficientNetPreTrained(PreTrainedModel):
|
312 |
|