fix(generate): skip local model validation when default_remote is set#4
Merged
Merged
Conversation
'tsr generate -m <model> ...' without an explicit -r/--remote flag was running _validate_model_available() against the local [comfyui] url even when config.toml had default_remote pointing at a different host. On a typical operator setup (default_remote = 'runpod', local comfyui url stale or empty) this fails with 'Model X not available on ComfyUI host (looked in checkpoints/ — 2 entries)' even though the model exists on the remote and would be reachable for the actual dispatch a few hundred lines later. Root cause: two validation gates used the raw 'remote' parameter (CLI flag only) instead of the resolved remote URL: - generate(): pre-fanout validation for --parallel-queue path - _run_generation(): per-call validation Both now use do_resolve_remote(remote), which returns the resolved URL when default_remote is set even if -r was omitted. The server- side validator on the remote tensors API still catches missing models on the remote host — matches the intent already documented in the comment block.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
…even though config has
default_remote = "runpod"and the model exists on the pod.Root cause
Two validation gates in
generate()/_run_generation()used the rawremoteCLI flag instead of the resolved remote URL:if model and not remote:if model and not json_output and not remote:When
-ris omitted butdefault_remoteis set in config, both treat the run as local and call_validate_model_available→get_loaded_models()against the local[comfyui].url(often a stale LAN address or empty). The actual dispatch ~100 lines later DOES respect default_remote, so the request would have worked if validation hadn't fired first.Fix
Both gates now use
do_resolve_remote(remote)— returns the resolved URL when default_remote is set even if-rwas omitted, so the local validation is skipped and the server-side validator on the remote tensors API takes over. Matches the intent already documented in the comment block: "Skipped in --json mode and for remote dispatches (server already validates)."Also dedupes the
do_resolve_remoteimport in_run_generation— moved to top of function instead of inline mid-body.Validation
uv run pytest tests/ -x→ 374 passeduv run ruff check tensors/cli.py→ All checks passeduv run ruff format --check tensors/cli.py→ already formatteduv run mypy tensors/cli.py→ no issuestsr generate -m obsessiveCompulsive_v20.safetensors "a cat on a table" -o /tmp/cat.pngfrom chi@fuji (no-rflag) → 1024×1024 PNG written, dispatched through pod's tensors API.