Skip to content

Commit

Permalink
Generator: Make sampler settings optional instead of default arg
Browse files Browse the repository at this point in the history
  • Loading branch information
turboderp committed Nov 12, 2024
1 parent 9089596 commit 16cd5ef
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions exllamav2/generator/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ def generate(
assert False, "Unexpected type in prompt"

if gen_settings is None:
p_settings = ExLlamaV2Sampler.Settings()
p_settings = None
elif isinstance(gen_settings, ExLlamaV2Sampler.Settings):
p_settings = gen_settings
elif isinstance(gen_settings, list):
Expand Down Expand Up @@ -1536,7 +1536,7 @@ def __init__(
max_new_tokens: int,
min_new_tokens: int = 0,
max_skips: int | None = 4,
gen_settings: ExLlamaV2Sampler.Settings = ExLlamaV2Sampler.Settings(),
gen_settings: ExLlamaV2Sampler.Settings | None = None,
seed: int = None,
stop_conditions: list | tuple | set = None,
decode_special_tokens: bool = False,
Expand Down Expand Up @@ -1629,6 +1629,9 @@ def __init__(
self.max_skips = max_skips
self.allocated_pages = None

if gen_settings is None:
gen_settings = ExLlamaV2Sampler.Settings()

# Prepare sequences

if not isinstance(input_ids, list):
Expand Down

0 comments on commit 16cd5ef

Please sign in to comment.