File size: 1,186 Bytes
b6d5f2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from transformers import PretrainedConfig

class BilmaConfig(PretrainedConfig):
    model_type = "bilma"

    def __init__(
        self,
        weights="spanish",
        num_attention_heads: int = 4,
        num_encoders: int = 2,
        max_length: int = 280,
        embedding_dim: int = 512,
        vocab_size: int = 28949,
        drop_rate: float = 0.1,        
        **kwargs,
    ):
        if weights not in ["spanish", ""]:
            raise ValueError(f"`weights` must be 'spanish' or '', got {weights}.")
        if weights == "spanish":
            self.weights = weights
            self.num_attention_heads = 4
            self.num_encoders = 2
            self.max_length = 280
            self.embedding_dim = 512
            self.vocab_size = 28949
            self.drop_rate = 0.1
            super().__init__(**kwargs)
            return

        self.weights = weights
        self.num_attention_heads = num_attention_heads
        self.num_encoders = num_encoders
        self.max_length = max_length
        self.embedding_dim = embedding_dim
        self.vocab_size = vocab_size
        self.drop_rate = drop_rate        
        super().__init__(**kwargs)