Skip to content

Commit

Permalink
Sampling: Fix override for DRY sequence breakers
Browse files Browse the repository at this point in the history
The common type should be an array of strings.

Signed-off-by: kingbri <[email protected]>
  • Loading branch information
bdashore3 committed Sep 8, 2024
1 parent 4f5ca7a commit 9c4a0e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class BaseSamplerRequest(BaseModel):
description=("Aliases: dry_penalty_last_n"),
)

dry_sequence_breakers: Optional[str] = Field(
dry_sequence_breakers: Optional[Union[str, List[str]]] = Field(
default_factory=lambda: get_default_sampler_value("dry_sequence_breakers", [])
)

Expand Down Expand Up @@ -330,7 +330,7 @@ def to_gen_params(self, **kwargs):

# Convert sequence breakers into an array of strings
# NOTE: This sampler sucks to parse.
if self.dry_sequence_breakers:
if self.dry_sequence_breakers and isinstance(self.dry_sequence_breakers, str):
if not self.dry_sequence_breakers.startswith("["):
self.dry_sequence_breakers = f"[{self.dry_sequence_breakers}]"

Expand Down
4 changes: 4 additions & 0 deletions sampler_overrides/sample_preset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ dry_allowed_length:
dry_range:
override: 0
force: false
dry_sequence_breakers:
override: []
force: false
additive: false

# MARK: Mirostat
mirostat_mode:
Expand Down

0 comments on commit 9c4a0e6

Please sign in to comment.