Upload parchment module: configuration_parchment.py
Browse files
parchment/configuration_parchment.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class ParchmentConfig(PretrainedConfig):
|
| 5 |
+
model_type = "parchment"
|
| 6 |
+
|
| 7 |
+
def __init__(
|
| 8 |
+
self,
|
| 9 |
+
vocab_size: int = 100277,
|
| 10 |
+
d_model: int = 768,
|
| 11 |
+
n_heads: int = 12,
|
| 12 |
+
n_layers: int = 12,
|
| 13 |
+
max_seq_len: int = 1024,
|
| 14 |
+
rms_norm_eps: float = 1e-6,
|
| 15 |
+
rope_base: float = 10000.0,
|
| 16 |
+
tie_word_embeddings: bool = True,
|
| 17 |
+
**kwargs,
|
| 18 |
+
):
|
| 19 |
+
self.vocab_size = vocab_size
|
| 20 |
+
self.d_model = d_model
|
| 21 |
+
self.n_heads = n_heads
|
| 22 |
+
self.n_layers = n_layers
|
| 23 |
+
self.max_seq_len = max_seq_len
|
| 24 |
+
self.rms_norm_eps = rms_norm_eps
|
| 25 |
+
self.rope_base = rope_base
|
| 26 |
+
# aliases expected by transformers internals
|
| 27 |
+
self.num_hidden_layers = n_layers
|
| 28 |
+
self.hidden_size = d_model
|
| 29 |
+
self.num_attention_heads = n_heads
|
| 30 |
+
super().__init__(tie_word_embeddings=tie_word_embeddings, **kwargs)
|