Upload configuration_hybridko.py with huggingface_hub
Browse files- configuration_hybridko.py +51 -0
configuration_hybridko.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""HybriKo Configuration - Hugging Face Compatible"""
|
| 3 |
+
|
| 4 |
+
from transformers import PretrainedConfig
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class HybriKoConfig(PretrainedConfig):
|
| 8 |
+
"""Configuration for HybriKo model.
|
| 9 |
+
|
| 10 |
+
HybriKo is a hybrid RNN-Attention language model optimized for Korean.
|
| 11 |
+
Uses a 2:1 ratio of RNN (Griffin) blocks to Attention blocks.
|
| 12 |
+
|
| 13 |
+
Attributes:
|
| 14 |
+
d_model: Hidden dimension size
|
| 15 |
+
n_layers: Number of transformer layers
|
| 16 |
+
vocab_size: Vocabulary size
|
| 17 |
+
n_heads: Number of attention heads
|
| 18 |
+
n_kv_heads: Number of key-value heads (for GQA)
|
| 19 |
+
ff_mult: Feed-forward multiplier
|
| 20 |
+
max_seq_len: Maximum sequence length
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
model_type = "hybridko"
|
| 24 |
+
|
| 25 |
+
def __init__(
|
| 26 |
+
self,
|
| 27 |
+
d_model: int = 768,
|
| 28 |
+
n_layers: int = 12,
|
| 29 |
+
vocab_size: int = 32000,
|
| 30 |
+
n_heads: int = 12,
|
| 31 |
+
n_kv_heads: int = 3,
|
| 32 |
+
ff_mult: int = 3,
|
| 33 |
+
max_seq_len: int = 512,
|
| 34 |
+
bos_token_id: int = 2,
|
| 35 |
+
eos_token_id: int = 3,
|
| 36 |
+
pad_token_id: int = 0,
|
| 37 |
+
**kwargs
|
| 38 |
+
):
|
| 39 |
+
super().__init__(
|
| 40 |
+
bos_token_id=bos_token_id,
|
| 41 |
+
eos_token_id=eos_token_id,
|
| 42 |
+
pad_token_id=pad_token_id,
|
| 43 |
+
**kwargs
|
| 44 |
+
)
|
| 45 |
+
self.d_model = d_model
|
| 46 |
+
self.n_layers = n_layers
|
| 47 |
+
self.vocab_size = vocab_size
|
| 48 |
+
self.n_heads = n_heads
|
| 49 |
+
self.n_kv_heads = n_kv_heads
|
| 50 |
+
self.ff_mult = ff_mult
|
| 51 |
+
self.max_seq_len = max_seq_len
|