Upload configuration_tips.py with huggingface_hub
Browse files- configuration_tips.py +46 -0
configuration_tips.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""TIPSv2 model configuration."""
|
| 2 |
+
|
| 3 |
+
from transformers import PretrainedConfig
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class TIPSv2Config(PretrainedConfig):
|
| 7 |
+
"""Configuration for TIPSv2 vision-language model."""
|
| 8 |
+
|
| 9 |
+
model_type = "tipsv2"
|
| 10 |
+
|
| 11 |
+
def __init__(
|
| 12 |
+
self,
|
| 13 |
+
# Vision encoder
|
| 14 |
+
vision_fn="vit_base",
|
| 15 |
+
embed_dim=768,
|
| 16 |
+
patch_size=14,
|
| 17 |
+
img_size=448,
|
| 18 |
+
ffn_layer="mlp",
|
| 19 |
+
init_values=1.0,
|
| 20 |
+
num_register_tokens=1,
|
| 21 |
+
# Text encoder
|
| 22 |
+
text_hidden_size=768,
|
| 23 |
+
text_mlp_dim=3072,
|
| 24 |
+
text_num_heads=12,
|
| 25 |
+
text_num_layers=12,
|
| 26 |
+
vocab_size=32000,
|
| 27 |
+
max_len=64,
|
| 28 |
+
# Contrastive
|
| 29 |
+
temperature=0.01,
|
| 30 |
+
**kwargs,
|
| 31 |
+
):
|
| 32 |
+
super().__init__(**kwargs)
|
| 33 |
+
self.vision_fn = vision_fn
|
| 34 |
+
self.embed_dim = embed_dim
|
| 35 |
+
self.patch_size = patch_size
|
| 36 |
+
self.img_size = img_size
|
| 37 |
+
self.ffn_layer = ffn_layer
|
| 38 |
+
self.init_values = init_values
|
| 39 |
+
self.num_register_tokens = num_register_tokens
|
| 40 |
+
self.text_hidden_size = text_hidden_size
|
| 41 |
+
self.text_mlp_dim = text_mlp_dim
|
| 42 |
+
self.text_num_heads = text_num_heads
|
| 43 |
+
self.text_num_layers = text_num_layers
|
| 44 |
+
self.vocab_size = vocab_size
|
| 45 |
+
self.max_len = max_len
|
| 46 |
+
self.temperature = temperature
|