Screen deeper LiSA sharing with complete autoregressive answers
This commit is contained in:
+5
-2
@@ -77,11 +77,13 @@ def attention(q, k, v):
|
||||
|
||||
|
||||
class StreamingLM:
|
||||
def __init__(self, weights, config, seconds=7200, enforce_memory=True):
|
||||
def __init__(self, weights, config, seconds=7200, enforce_memory=True,
|
||||
process_swap_limit_kib=128*1024):
|
||||
self.tensors = load_tensors(Path(weights))
|
||||
self.config = config.get('text_config', config)
|
||||
self.deadline = time.monotonic() + seconds
|
||||
self.enforce_memory = enforce_memory
|
||||
self.process_swap_limit_kib = process_swap_limit_kib
|
||||
self.eps = self.config['rms_norm_eps']
|
||||
self.norm_replacement = None
|
||||
self.capture_qk = False
|
||||
@@ -107,7 +109,8 @@ class StreamingLM:
|
||||
rate = (count-self.swap_observation[1])*4096/elapsed
|
||||
self.swap_pressure_windows = self.swap_pressure_windows+1 if rate > 4*1024**2 else 0
|
||||
own_swap_kib = int(status.get('VmSwap', '0 kB').split()[0])
|
||||
if self.swap_pressure_windows >= 3 and (available < 384*1024 or own_swap_kib > 128*1024):
|
||||
if self.swap_pressure_windows >= 3 and (
|
||||
available < 384*1024 or own_swap_kib > self.process_swap_limit_kib):
|
||||
raise MemoryError(f'Sustained host swap pressure plus constrained memory: available={available} KiB, process_swap={own_swap_kib} KiB')
|
||||
self.swap_observation = (now,count)
|
||||
if rss_kib > 512*1024 or available < 256*1024:
|
||||
|
||||
Reference in New Issue
Block a user