Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion llama_cpp/llama.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,11 @@ def __init__(
self.n_threads_batch = n_threads_batch or multiprocessing.cpu_count()

# Used by the sampler
self._seed = seed or llama_cpp.LLAMA_DEFAULT_SEED
if seed == -1:
# set a random seed
self._seed = random.randint(0, 2 ** 32)
else:
self._seed = seed or llama_cpp.LLAMA_DEFAULT_SEED

# Context Params
self.context_params = llama_cpp.llama_context_default_params()
Expand Down