创建缓存的深拷贝 Returns: CustomDynamicCache: 缓存的新副本
(self)
| 99 | return layer_seq_length |
| 100 | |
| 101 | def copy(self): |
| 102 | """ |
| 103 | 创建缓存的深拷贝 |
| 104 | |
| 105 | Returns: |
| 106 | CustomDynamicCache: 缓存的新副本 |
| 107 | """ |
| 108 | new_cache = CustomDynamicCache() |
| 109 | new_cache.key_cache = [k.clone() for k in self.key_cache] |
| 110 | new_cache.value_cache = [v.clone() for v in self.value_cache] |
| 111 | new_cache.cache_kwargs = copy.deepcopy(self.cache_kwargs) |
| 112 | new_cache.group_cache = copy.deepcopy(self.group_cache) |
| 113 | new_cache.meta = copy.deepcopy(self.meta) |
| 114 | new_cache._seen_tokens = self._seen_tokens |
| 115 | return new_cache |
| 116 | |
| 117 | def update_router_kcache( |
| 118 | self, |
no test coverage detected