Hoglet-33 commited on
Commit
6f8523e
·
verified ·
1 Parent(s): 7233995

Create configuration_pebble.py

Browse files
Files changed (1) hide show
  1. configuration_pebble.py +41 -0
configuration_pebble.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import PretrainedConfig
2
+
3
+ class PebbleConfig(PretrainedConfig):
4
+ model_type = "pebble_10m"
5
+
6
+ def __init__(
7
+ self,
8
+ vocab_size=2048,
9
+ hidden_size=384,
10
+ intermediate_size=1536,
11
+ num_hidden_layers=8,
12
+ num_attention_heads=6,
13
+ block_pattern="mmma|mmma",
14
+ hybrid_ratio="3:1 mamba2:attention",
15
+ max_position_embeddings=512,
16
+ rms_norm_eps=1e-6,
17
+ tie_word_embeddings=True,
18
+ mamba2=None,
19
+ attention=None,
20
+ **kwargs,
21
+ ):
22
+ self.vocab_size = vocab_size
23
+ self.hidden_size = hidden_size
24
+ self.intermediate_size = intermediate_size
25
+ self.num_hidden_layers = num_hidden_layers
26
+ self.num_attention_heads = num_attention_heads
27
+ self.block_pattern = block_pattern
28
+ self.hybrid_ratio = hybrid_ratio
29
+ self.max_position_embeddings = max_position_embeddings
30
+ self.rms_norm_eps = rms_norm_eps
31
+ self.tie_word_embeddings = tie_word_embeddings
32
+
33
+ # Default dictionaries if not provided in config.json
34
+ self.mamba2 = mamba2 or {
35
+ "d_state": 128, "d_conv": 4, "expand": 2,
36
+ "headdim": 96, "use_mem_eff_path": True
37
+ }
38
+ self.attention = attention or {
39
+ "rope_theta": 10000.0, "is_causal": True
40
+ }
41
+ super().__init__(**kwargs)