Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6595ad8

Browse filesBrowse files
committed
Add field to disable reseting between generations
1 parent 22fa5a6 commit 6595ad8
Copy full SHA for 6595ad8

File tree

Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎llama_cpp/llama.py‎

Copy file name to clipboardExpand all lines: llama_cpp/llama.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ def generate(
218218
top_p: float,
219219
temp: float,
220220
repeat_penalty: float,
221+
reset: bool = True,
221222
) -> Generator[
222223
llama_cpp.llama_token, Optional[Sequence[llama_cpp.llama_token]], None
223224
]:
@@ -235,12 +236,14 @@ def generate(
235236
top_p: The top-p sampling parameter.
236237
temp: The temperature parameter.
237238
repeat_penalty: The repeat penalty parameter.
239+
reset: Whether to reset the model state.
238240
239241
Yields:
240242
The generated tokens.
241243
"""
242244
assert self.ctx is not None
243-
self.reset()
245+
if reset:
246+
self.reset()
244247
while True:
245248
self.eval(tokens)
246249
token = self.sample(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.