arjunraj commited on
Commit
2364cb5
·
verified ·
1 Parent(s): cf54e28

Add configuration code for trust_remote_code

Browse files
Files changed (1) hide show
  1. configuration_condensatenet.py +42 -0
configuration_condensatenet.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """CondensateNet Configuration"""
2
+
3
+ from transformers import PretrainedConfig
4
+ from typing import Tuple
5
+
6
+
7
+ class CondensateNetConfig(PretrainedConfig):
8
+ """
9
+ Configuration for CondensateNet.
10
+
11
+ Stores all hyperparameters needed to reconstruct the model architecture.
12
+
13
+ Args:
14
+ encoder_variant: EfficientNetV2 variant to use (default: "rw_s")
15
+ pyramid_channels: Channel dimensions for FPN levels
16
+ pyramid_dim: Dimension of FPN feature maps
17
+ use_spatial_attention: Whether to use sparse spatial attention
18
+ spatial_kernel_size: Kernel size for spatial attention
19
+ dropout_rate: Dropout rate for regularization
20
+ num_classes: Number of output classes (1 for binary segmentation)
21
+ """
22
+ model_type = "condensatenet"
23
+
24
+ def __init__(
25
+ self,
26
+ encoder_variant: str = "rw_s",
27
+ pyramid_channels: Tuple[int, ...] = (24, 48, 64, 160),
28
+ pyramid_dim: int = 32,
29
+ use_spatial_attention: bool = True,
30
+ spatial_kernel_size: int = 11,
31
+ dropout_rate: float = 0.15,
32
+ num_classes: int = 1,
33
+ **kwargs
34
+ ):
35
+ super().__init__(**kwargs)
36
+ self.encoder_variant = encoder_variant
37
+ self.pyramid_channels = list(pyramid_channels)
38
+ self.pyramid_dim = pyramid_dim
39
+ self.use_spatial_attention = use_spatial_attention
40
+ self.spatial_kernel_size = spatial_kernel_size
41
+ self.dropout_rate = dropout_rate
42
+ self.num_classes = num_classes