HTill commited on
Commit
cfb933c
·
verified ·
1 Parent(s): 1b276b7

Update configuration_eat.py

Browse files
Files changed (1) hide show
  1. configuration_eat.py +67 -58
configuration_eat.py CHANGED
@@ -1,58 +1,67 @@
1
- # configuration_eat.py
2
-
3
- from transformers import PretrainedConfig
4
-
5
- class EATConfig(PretrainedConfig):
6
- model_type = "eat"
7
-
8
- def __init__(
9
- self,
10
- embed_dim=768,
11
- depth=12,
12
- num_heads=12,
13
- patch_size=16,
14
- stride=16,
15
- in_chans=1,
16
- num_classes=527,
17
- model_variant="pretrain", # or "finetune"
18
-
19
- mlp_ratio=4.0,
20
- qkv_bias=True,
21
- drop_rate=0.0,
22
- attn_drop_rate=0.0,
23
- activation_dropout=0.0,
24
- post_mlp_drop=0.0,
25
- start_drop_path_rate=0.0,
26
- end_drop_path_rate=0.0,
27
-
28
- layer_norm_first=False,
29
- norm_eps=1e-6,
30
- norm_affine=True,
31
- fixed_positions=True,
32
-
33
- **kwargs,
34
- ):
35
- super().__init__(**kwargs)
36
-
37
- self.embed_dim = embed_dim
38
- self.depth = depth
39
- self.num_heads = num_heads
40
- self.patch_size = patch_size
41
- self.stride = stride
42
- self.in_chans = in_chans
43
- self.num_classes = num_classes
44
- self.model_variant = model_variant
45
-
46
- self.mlp_ratio = mlp_ratio
47
- self.qkv_bias = qkv_bias
48
- self.drop_rate = drop_rate
49
- self.attn_drop_rate = attn_drop_rate
50
- self.activation_dropout = activation_dropout
51
- self.post_mlp_drop = post_mlp_drop
52
- self.start_drop_path_rate = start_drop_path_rate
53
- self.end_drop_path_rate = end_drop_path_rate
54
-
55
- self.layer_norm_first = layer_norm_first
56
- self.norm_eps = norm_eps
57
- self.norm_affine = norm_affine
58
- self.fixed_positions = fixed_positions
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import PretrainedConfig
2
+
3
+ class EATConfig(PretrainedConfig):
4
+ model_type = "eat"
5
+
6
+ def __init__(
7
+ self,
8
+ # --- 1. Core Architecture (Dimensions) ---
9
+ embed_dim=768,
10
+ depth=12,
11
+ num_heads=12,
12
+ mlp_ratio=4.0,
13
+ num_classes=527,
14
+ model_variant="pretrain", # or "finetune"
15
+
16
+ # --- 2. Input & Patching ---
17
+ in_chans=1,
18
+ patch_size=16,
19
+ stride=16,
20
+ fixed_positions=True,
21
+
22
+ # --- 3. Normalization & Bias Structure ---
23
+ qkv_bias=True,
24
+ layer_norm_first=False,
25
+ norm_affine=True,
26
+ norm_eps=1e-6,
27
+
28
+ # --- 4. Fine-Tuning Knobs (Regularization) ---
29
+ drop_rate=0.0,
30
+ attn_drop_rate=0.0,
31
+ activation_dropout=0.0,
32
+ post_mlp_drop=0.0,
33
+ start_drop_path_rate=0.0,
34
+ end_drop_path_rate=0.0,
35
+
36
+ # --- 5. Hugging Face Extras ---
37
+ **kwargs,
38
+ ):
39
+ super().__init__(**kwargs)
40
+
41
+ # --- 1. Core Architecture ---
42
+ self.embed_dim = embed_dim
43
+ self.depth = depth
44
+ self.num_heads = num_heads
45
+ self.mlp_ratio = mlp_ratio
46
+ self.num_classes = num_classes
47
+ self.model_variant = model_variant
48
+
49
+ # --- 2. Input & Patching ---
50
+ self.in_chans = in_chans
51
+ self.patch_size = patch_size
52
+ self.stride = stride
53
+ self.fixed_positions = fixed_positions
54
+
55
+ # --- 3. Normalization & Bias ---
56
+ self.qkv_bias = qkv_bias
57
+ self.layer_norm_first = layer_norm_first
58
+ self.norm_affine = norm_affine
59
+ self.norm_eps = norm_eps
60
+
61
+ # --- 4. Regularization ---
62
+ self.drop_rate = drop_rate
63
+ self.attn_drop_rate = attn_drop_rate
64
+ self.activation_dropout = activation_dropout
65
+ self.post_mlp_drop = post_mlp_drop
66
+ self.start_drop_path_rate = start_drop_path_rate
67
+ self.end_drop_path_rate = end_drop_path_rate