Repository navigation
Conversation
change_sovits_weights() is a generator function (it yields Gradio update dicts for the webui), but inference_cli.py and inference_gui.py called it as a plain statement. The call only built a generator object: the body never ran, so --sovits_model was silently ignored and synthesis used the default v2 model loaded at import time (fixes RVC-Boss#2829). Iterating the generator end-to-end exposed a second latent bug: the post-load yield references six locals (prompt_text_update, prompt_language_update, text_update, text_language_update, visible_sample_steps, visible_inp_refs) that were only assigned when the webui passes UI language args, so any arg-less call raised UnboundLocalError at that yield - previously masked by the bare try/except around the import-time next(). Initialize them with neutral defaults; the webui path overwrites them unchanged. Verified on Windows/CPU with v2 pretrained models: a bogus --sovits_model now fails fast with FileNotFoundError instead of silently using the default model; a valid path loads (double 'loading sovits_v2' log) and synthesizes; the webui-style call still yields its two UI events.
kyo-zzz
force-pushed
the
fix/inference-entrypoints-ignored-sovits-weights
branch
from
October 11, 2026 07:47
51c0e00 to
c2a1dec
Compare
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.


Problem
inference_cli.pyandinference_gui.pycallchange_sovits_weights()as a plain statement. That function is a generator (it yields Gradio UI-update dicts for the webui), so calling it only creates a generator object: the body never runs. As a result--sovits_modelis silently ignored —change_gpt_weights()works because it is a regular function, which is exactly the asymmetry that makes this easy to miss. Audio still gets produced becauseinference_webuiloads the default v2 model at import time (its ownnext(...)call, wrapped in a baretry/except), so the CLI synthesizes with whatever model was loaded at startup instead of the one the user asked for.Fixes #2829.
What changed
inference_cli.py/inference_gui.py— iterate the generator (for _ in change_sovits_weights(...): pass) so the SoVITS weights actually load and load errors surface.inference_webui.py— consuming the generator end-to-end exposed a second latent bug: the post-loadyieldreferences six locals (prompt_text_update,prompt_language_update,text_update,text_language_update,visible_sample_steps,visible_inp_refs) that were only assigned when the webui passes UI language args. Any arg-less call therefore raisedUnboundLocalErrorat that yield — invisible until now because the import-timenext()swallows everything withexcept: pass. These six locals now get neutral defaults ({"__type__": "update"}/False); the webui path overwrites all of them exactly as before.Verification
Windows 11, CPU only (
torch 2.5.1+cpu), v2 pretrained models (s1bert25hz-5kh-longer-epoch=12-step=369668.ckpt+s2G2333k.pth):inference_cli.py --sovits_model NONEXISTENT_BOGUS.pth→ exit 0,output.wavproduced, using the silently-wrong default model. No error anywhere.FileNotFoundError: [Errno 2] No such file or directory: 'NONEXISTENT_BOGUS.pth'— fails fast instead of silently synthesizing with the wrong model.output.wavproduced, and the log showsloading sovits_v2 <All keys matched successfully>twice (import-time load + the CLI's own call) with the requested path echoed by the function's ownprint— the requested model actually loads.change_sovits_weights(sovits_path, prompt_language="中文", text_language="中文")and consuming the generator yields exactly 2 events, the button goes disabled → interactive, and the 4th update dict carriesvalue == "中文"from the argument — gradio behavior unchanged.ruff checkon the three touched files reports the same 62 pre-existing findings before and after the change (none in the added lines);ruff format --diffoutput is identical to the pristine file's (all pre-existing).Note
The GUI call site gets the identical fix; I verified it by code-path identity (same function, same consumption pattern, same arg-less signature) — the runtime evidence above comes from the CLI, which shares the entire loading path.