fix(cli): normalize max seed. v0.3.1

This commit is contained in:
KingManiya
2026-04-21 00:57:41 +04:00
parent 80b36c8a65
commit 40a112c8b7
3 changed files with 16 additions and 3 deletions
+13 -1
View File
@@ -22,6 +22,9 @@ MMPROJ_EMBEDDING_MISMATCH_RE = re.compile(
)
START_THINKING = "[Start thinking]"
END_THINKING = "[End thinking]"
LLAMA_RANDOM_SEED = -1
LLAMA_SEED_MODULUS = 2**32
MAX_LLAMA_SEED = LLAMA_SEED_MODULUS - 1
def tensor_to_temp_png(image) -> Path:
@@ -59,6 +62,15 @@ def split_extra_args(extra_args: str) -> list[str]:
return [part.strip("\"'") for part in parts]
def normalize_llama_seed(seed: int) -> int:
seed = int(seed)
if seed == LLAMA_RANDOM_SEED:
return LLAMA_RANDOM_SEED
if 0 <= seed <= MAX_LLAMA_SEED:
return seed
return seed % LLAMA_SEED_MODULUS
def build_command(
model_path: Path,
mmproj_path: Path | None,
@@ -99,7 +111,7 @@ def build_command(
"--top-k", str(top_k),
"--repeat-penalty", str(repeat_penalty),
"-c", str(ctx_size),
"--seed", str(seed),
"--seed", str(normalize_llama_seed(seed)),
"--single-turn",
"--reasoning", reasoning,
]
+2 -1
View File
@@ -10,6 +10,7 @@ from .folder_registry import (
system_prompt_options,
)
from .llama_cli import (
MAX_LLAMA_SEED,
build_command,
run_llama_cli,
split_extra_args,
@@ -104,7 +105,7 @@ class QwenGGUF:
"seed": ("INT", {
"default": 1,
"min": -1,
"max": 2**32 - 1, # MAX_LLAMA_SEED
"max": MAX_LLAMA_SEED,
"tooltip": "Random seed. Use -1 for a random seed.",
}),
"timeout_seconds": ("INT", {
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "ComfyUI-Qwen-gguf"
description = "Run Qwen3-VL, Qwen3.5, and Qwen3.6 GGUF models in ComfyUI with llama.cpp."
version = "0.3.0"
version = "0.3.1"
license = {file = "LICENSE"}
dependencies = ["numpy", "Pillow"]