根据参数创建合适的缓存实例 Args: args: 包含量化相关参数的命名空间对象 Returns: CustomDynamicCache or CustomQuantizeDynamicCache: 缓存实例
(quantize_nbits: Optional[int] = 0)
| 335 | |
| 336 | |
| 337 | def create_cache(quantize_nbits: Optional[int] = 0): |
| 338 | """ |
| 339 | 根据参数创建合适的缓存实例 |
| 340 | |
| 341 | Args: |
| 342 | args: 包含量化相关参数的命名空间对象 |
| 343 | |
| 344 | Returns: |
| 345 | CustomDynamicCache or CustomQuantizeDynamicCache: 缓存实例 |
| 346 | """ |
| 347 | if quantize_nbits > 0: |
| 348 | quan_cache_config = QuantizedCacheConfig(nbits=quantize_nbits) |
| 349 | return CustomQuantizeDynamicCache(quan_cache_config) |
| 350 | else: |
| 351 | return CustomDynamicCache() |
| 352 | |
| 353 | def manual_deepcopy_kv_cache(cache_obj): |
| 354 | """ |
no test coverage detected