Upload config.py with huggingface_hub
Browse files
config.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import AutoConfig, PretrainedConfig
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class EngramConfig(PretrainedConfig):
|
| 5 |
+
model_type = "engram"
|
| 6 |
+
|
| 7 |
+
def __init__(
|
| 8 |
+
self,
|
| 9 |
+
vocab_size=50257,
|
| 10 |
+
d_model=384,
|
| 11 |
+
ngram_orders=[2, 3],
|
| 12 |
+
num_heads=2,
|
| 13 |
+
bucket_size=100_000,
|
| 14 |
+
engram_dim=192,
|
| 15 |
+
injection_layer=1,
|
| 16 |
+
**kwargs,
|
| 17 |
+
):
|
| 18 |
+
self.vocab_size = vocab_size
|
| 19 |
+
self.d_model = d_model
|
| 20 |
+
self.ngram_orders = ngram_orders
|
| 21 |
+
self.num_heads = num_heads
|
| 22 |
+
self.bucket_size = bucket_size
|
| 23 |
+
self.engram_dim = engram_dim
|
| 24 |
+
self.injection_layer = injection_layer
|
| 25 |
+
super().__init__(**kwargs)
|
| 26 |
+
|
| 27 |
+
AutoConfig.register("engram", EngramConfig)
|