mirror of
https://github.com/turboderp-org/exllamav3.git
synced 2026-04-23 07:49:05 +00:00
Config: Read and expose max_position_embeddings
This commit is contained in:
@@ -138,6 +138,11 @@ class Gemma3Config(Config):
|
||||
self.vision_pp.size = read_dict(read_prep_config, dict, ["size"], no_default)
|
||||
|
||||
|
||||
def default_max_position_embeddings(self):
|
||||
# Fixed for Gemma3, usually not present in config.json
|
||||
return 131072
|
||||
|
||||
|
||||
class Gemma3TextConfig(Config):
|
||||
arch_string = "Gemma3ForCausalLM"
|
||||
|
||||
@@ -218,6 +223,11 @@ class Gemma3TextConfig(Config):
|
||||
self.final_logit_softcapping = self.read_cfg(float, "final_logit_softcapping", 0.0)
|
||||
|
||||
|
||||
def default_max_position_embeddings(self):
|
||||
# Fixed for Gemma2, usually not present in config.json
|
||||
return 8192
|
||||
|
||||
|
||||
class Gemma3Model(Model):
|
||||
config_class = Gemma3Config
|
||||
|
||||
|
||||
@@ -69,11 +69,16 @@ class Config(ABC):
|
||||
self.num_q_heads = -1
|
||||
self.num_kv_heads = -1
|
||||
self.pos_encoding_mode = "NONE"
|
||||
self.max_position_embeddings = self.read_cfg(int, "max_position_embeddings", self.default_max_position_embeddings())
|
||||
|
||||
# Load parameters
|
||||
self.load_isq = False
|
||||
|
||||
|
||||
def default_max_position_embeddings(self):
|
||||
return 8192
|
||||
|
||||
|
||||
def read_cfg(self, *args):
|
||||
"""
|
||||
Read from config.json, see read()
|
||||
|
||||
Reference in New Issue
Block a user