|
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) |