[Misc] Clean up more utils (#27567)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -1618,6 +1618,29 @@ class ModelConfig:
|
||||
"""Extract the HF encoder/decoder model flag."""
|
||||
return is_encoder_decoder(self.hf_config)
|
||||
|
||||
@property
|
||||
def uses_alibi(self) -> bool:
|
||||
cfg = self.hf_text_config
|
||||
|
||||
return (
|
||||
getattr(cfg, "alibi", False) # Falcon
|
||||
or "BloomForCausalLM" in self.architectures # Bloom
|
||||
or getattr(cfg, "position_encoding_type", "") == "alibi" # codellm_1b_alibi
|
||||
or (
|
||||
hasattr(cfg, "attn_config") # MPT
|
||||
and (
|
||||
(
|
||||
isinstance(cfg.attn_config, dict)
|
||||
and cfg.attn_config.get("alibi", False)
|
||||
)
|
||||
or (
|
||||
not isinstance(cfg.attn_config, dict)
|
||||
and getattr(cfg.attn_config, "alibi", False)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@property
|
||||
def uses_mrope(self) -> bool:
|
||||
return uses_mrope(self.hf_config)
|
||||
|
||||
Reference in New Issue
Block a user