MCPcopy Create free account
hub / github.com/EverMind-AI/MSA / copy

Method copy

src/utils/cache.py:317–334  ·  view source on GitHub ↗

创建缓存的深拷贝 Returns: CustomQuantizeDynamicCache: 缓存的新副本

(self)

Source from the content-addressed store, hash-verified

315 return self
316
317 def copy(self):
318 """
319 创建缓存的深拷贝
320
321 Returns:
322 CustomQuantizeDynamicCache: 缓存的新副本
323 """
324 new_cache = CustomQuantizeDynamicCache(self.cache_config)
325 if hasattr(self, '_quantized_key_cache'):
326 new_cache._quantized_key_cache = [k.clone() for k in self._quantized_key_cache]
327 new_cache._quantized_value_cache = [v.clone() for v in self._quantized_value_cache]
328 new_cache.key_cache = [k.clone() for k in self.key_cache]
329 new_cache.value_cache = [v.clone() for v in self.value_cache]
330 new_cache.cache_kwargs = copy.deepcopy(self.cache_kwargs)
331 new_cache.group_cache = copy.deepcopy(self.group_cache)
332 new_cache.meta = copy.deepcopy(self.meta)
333 new_cache._seen_tokens = self._seen_tokens
334 return new_cache
335
336
337def create_cache(quantize_nbits: Optional[int] = 0):

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected