bitcache-distilgpt2 / configuration_bitcache.py
KelvinAxhcar's picture
Initial release of BitCache: Spectral Isoperimetric KV-Cache Compression
2c65306 verified
Raw History Blame Contribute Delete
944 Bytes
"""
Configuração do Modelo Hugging Face com Integração BitCache
"""
from transformers import GPT2Config
class BitCacheGPT2Config(GPT2Config):
model_type = "bitcache-gpt2"
def __init__(
self,
retention_ratio: float = 0.35,
profile: str = "cheeger_catalan",
protect_sink: int = 4,
protect_recent: int = 16,
boundary_window: int = 16,
boundary_expansion: int = 6,
**kwargs
):
super().__init__(**kwargs)
self.retention_ratio = retention_ratio
self.profile = profile
self.protect_sink = protect_sink
self.protect_recent = protect_recent
self.boundary_window = boundary_window
self.boundary_expansion = boundary_expansion
self.auto_map = {
"AutoConfig": "configuration_bitcache.BitCacheGPT2Config",
"AutoModelForCausalLM": "modeling_bitcache.BitCacheGPT2LMHeadModel",
}