(attr_name)
| 127 | ) |
| 128 | |
| 129 | def _install_cache(attr_name): |
| 130 | setattr(module, attr_name, mlx_cache) |
| 131 | for i, (cache_layer, layer_cache) in enumerate( |
| 132 | zip(mlx_cache.layers, mlx_cache.kv_cache) |
| 133 | ): |
| 134 | setattr(module, f"key_cache_{i}", layer_cache.k_cache) |
| 135 | setattr(module, f"value_cache_{i}", layer_cache.v_cache) |
| 136 | if hasattr(cache_layer, "cumulative_length"): |
| 137 | setattr( |
| 138 | module, |
| 139 | f"cumulative_length_{i}", |
| 140 | cache_layer.cumulative_length, |
| 141 | ) |
| 142 | |
| 143 | if hasattr(module, "static_cache"): |
| 144 | assert isinstance( |
no outgoing calls
no test coverage detected