aryaaan12 commited on
Commit
e98924d
·
verified ·
1 Parent(s): 485629f

Upload configuration_tren.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. configuration_tren.py +41 -0
configuration_tren.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import PretrainedConfig
2
+
3
+
4
+ class TRENConfig(PretrainedConfig):
5
+ """
6
+ Configuration for T-REN (Text-aligned Region Encoder Network).
7
+
8
+ The trainable T-REN head (RegionEncoder) weights are stored in this HF repo.
9
+ The DINOv3 ViT-L/16 backbone weights must be downloaded separately from
10
+ Facebook Research (see load_backbone() in TRENModel).
11
+ """
12
+
13
+ model_type = "tren"
14
+ auto_map = {
15
+ "AutoConfig": "configuration_tren.TRENConfig",
16
+ "AutoModel": "modeling_tren.TRENModel",
17
+ }
18
+
19
+ def __init__(
20
+ self,
21
+ patch_size: int = 16,
22
+ hidden_dim: int = 1024,
23
+ text_embed_dim: int = 1024,
24
+ num_decoder_layers: int = 2,
25
+ num_attention_heads: int = 8,
26
+ image_resolution: int = 512,
27
+ num_multiscale_regions: int = 3,
28
+ merging_iou_threshold: float = 0.8,
29
+ merging_similarity_threshold: float = 0.975,
30
+ **kwargs,
31
+ ):
32
+ self.patch_size = patch_size
33
+ self.hidden_dim = hidden_dim
34
+ self.text_embed_dim = text_embed_dim
35
+ self.num_decoder_layers = num_decoder_layers
36
+ self.num_attention_heads = num_attention_heads
37
+ self.image_resolution = image_resolution
38
+ self.num_multiscale_regions = num_multiscale_regions
39
+ self.merging_iou_threshold = merging_iou_threshold
40
+ self.merging_similarity_threshold = merging_similarity_threshold
41
+ super().__init__(**kwargs)