| 8 | |
| 9 | @dataclass |
| 10 | class TIDEConfig: |
| 11 | checkpoint_interval: int = 4 |
| 12 | exit_threshold: float = 0.85 |
| 13 | min_layers: int = 8 |
| 14 | compaction_threshold: float = 0.25 |
| 15 | exit_strategy: str = "identity" |
| 16 | calibration_samples: int = 2000 |
| 17 | calibration_dataset: str = "wikitext" |
| 18 | router_bottleneck_dim: int = 128 |
| 19 | convergence_threshold: float = 0.98 |
| 20 | kv_cache_strategy: str = "zero_pad" # "zero_pad" or future "propagate" |
| 21 | profile: bool = False |
| 22 | |
| 23 | def save(self, path: str | Path) -> None: |
| 24 | path = Path(path) |
| 25 | path.parent.mkdir(parents=True, exist_ok=True) |
| 26 | with open(path, "w") as f: |
| 27 | yaml.dump(asdict(self), f, default_flow_style=False) |
| 28 | |
| 29 | @classmethod |
| 30 | def load(cls, path: str | Path) -> TIDEConfig: |
| 31 | with open(path) as f: |
| 32 | data = yaml.safe_load(f) |
| 33 | return cls(**data) |
no outgoing calls