File size: 1,760 Bytes
ce7cacf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from transformers import CamembertConfig


class CLIPTextCamembertConfig(CamembertConfig):
    # ref : https://huggingface.co/airesearch/wangchanberta-base-att-spm-uncased/blob/main/config.json
    model_type = "clip_text_camembert"

    def __init__(
        self,
        vocab_size=25005,
        hidden_size=768,
        intermediate_size=3072,
        projection_dim=512,
        num_hidden_layers=12,
        num_attention_heads=12,
        max_position_embeddings=512,
        hidden_act="gelu",
        layer_norm_eps=1e-12,
        attention_dropout=0.1,
        initializer_range=0.02,
        initializer_factor=1.0,
        pad_token_id=1,
        bos_token_id=0,
        eos_token_id=2,
        type_vocab_size=1,
        **kwargs,
    ):
        super().__init__(
            pad_token_id=pad_token_id,
            bos_token_id=bos_token_id,
            eos_token_id=eos_token_id,
            **kwargs,
        )

        self.vocab_size = vocab_size
        self.hidden_size = hidden_size
        self.intermediate_size = intermediate_size
        self.projection_dim = projection_dim
        self.num_hidden_layers = num_hidden_layers
        self.num_attention_heads = num_attention_heads
        self.max_position_embeddings = max_position_embeddings
        self.layer_norm_eps = layer_norm_eps
        self.hidden_act = hidden_act
        self.initializer_range = initializer_range
        self.initializer_factor = initializer_factor
        self.attention_dropout = attention_dropout
        self.type_vocab_size = type_vocab_size
        self.auto_map = {
            "AutoConfig": "configuration_clip_camembert.CLIPTextCamembertConfig",
            "AutoModel": "modeling_clip_camembert.CLIPTextCamembertModelWithProjection",
        }