perf: disable KV cache when obtaining module I/O (#566)

This commit is contained in:
Philipp Emanuel Weidmann 2026-11-05 18:07:14 +05:30 committed by GitHub
parent b4864fdd59
commit 3dbc48156d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 1 deletions

View File

@ -235,6 +235,10 @@ class Model:
)
],
max_new_tokens=1,
# The KV cache is deliberately left enabled here so we can
# catch dtype errors related to the cache, which we will need
# for generating responses.
# use_cache=False,
)
except Exception as error:
self.model = None
@ -855,7 +859,11 @@ class Model:
)
)
self.generate(prompts, max_new_tokens=1)
self.generate(
prompts,
max_new_tokens=1,
use_cache=False,
)
for hook_handle in hook_handles:
hook_handle.remove()