mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2025-09-10 15:29:39 +00:00
fix-singleton
This commit is contained in:
parent
7f57769c23
commit
6f43bbe55f
4 changed files with 11 additions and 4 deletions
|
@ -26,6 +26,7 @@ import json
|
|||
|
||||
class DynamicScaledDotProductAttention:
|
||||
remaining_length: int
|
||||
cpu_infer = None
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -180,7 +181,9 @@ class DynamicScaledDotProductAttention:
|
|||
self.preselect_block_num = 0 # block_num before preselect
|
||||
self.evict_tokens = 0
|
||||
|
||||
self.cpu_infer = CPUInfer(threads_num)
|
||||
if DynamicScaledDotProductAttention.cpu_infer is None:
|
||||
DynamicScaledDotProductAttention.cpu_infer = CPUInfer(threads_num)
|
||||
self.cpu_infer = DynamicScaledDotProductAttention.cpu_infer
|
||||
self.local_thread = CPUInferKVCache(
|
||||
self.layer_num,
|
||||
self.kv_head_num,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue