RVC-Boss/GPT-SoVITS · error · FileNotFoundError

SoVITS %s 底模缺失,无法加载相应 LoRA 权重

Error message

SoVITS %s 底模缺失,无法加载相应 LoRA 权重

What it means

Raised by init_vits_weights() when loading a SoVITS LoRA checkpoint whose detected model version is v3/v4 but the corresponding base (底模) checkpoint file does not exist at the path stored in configs.default_configs[model_version]['vits_weights_path']. LoRA weights only contain adapter deltas, so the full base model must be present to merge into. The message concatenates the expected base-model path with the missing-model notice so the user knows exactly which file to download.

Source

Thrown at GPT_SoVITS/TTS_infer_pack/TTS.py:502

    def init_bert_weights(self, base_path: str):
        print(f"Loading BERT weights from {base_path}")
        self.bert_tokenizer = AutoTokenizer.from_pretrained(base_path)
        self.bert_model = AutoModelForMaskedLM.from_pretrained(base_path)
        self.bert_model = self.bert_model.eval()
        self.bert_model = self.bert_model.to(self.configs.device)
        if self.configs.is_half and str(self.configs.device) != "cpu":
            self.bert_model = self.bert_model.half()

    def init_vits_weights(self, weights_path: str):
        self.configs.vits_weights_path = weights_path
        version, model_version, if_lora_v3 = get_sovits_version_from_path_fast(weights_path)
        if "Pro" in model_version:
            self.init_sv_model()
        path_sovits = self.configs.default_configs[model_version]["vits_weights_path"]

        if if_lora_v3 == True and os.path.exists(path_sovits) == False:
            info = path_sovits + i18n("SoVITS %s 底模缺失,无法加载相应 LoRA 权重" % model_version)
            raise FileNotFoundError(info)

        # dict_s2 = torch.load(weights_path, map_location=self.configs.device,weights_only=False)
        dict_s2 = load_sovits_new(weights_path)
        hps = dict_s2["config"]
        hps["model"]["semantic_frame_rate"] = "25hz"
        if "enc_p.text_embedding.weight" not in dict_s2["weight"]:
            hps["model"]["version"] = "v2"  # v3model,v2sybomls
        elif dict_s2["weight"]["enc_p.text_embedding.weight"].shape[0] == 322:
            hps["model"]["version"] = "v1"
        else:
            hps["model"]["version"] = "v2"
        version = hps["model"]["version"]
        v3v4set = {"v3", "v4"}
        if model_version not in v3v4set:
            if "Pro" not in model_version:
                model_version = version
            else:
                hps["model"]["version"] = model_version

View on GitHub (pinned to d523079fc0)

Solutions

  1. Download the matching SoVITS v3 or v4 pretrained base models and place them under GPT_SoVITS/pretrained_models/ (check the exact expected path shown at the start of the error message).
  2. Verify the path in configs.default_configs[model_version]['vits_weights_path'] actually points to the directory where you keep base models; update it if you relocated pretrained_models.
  3. If you do not need v3/v4 features, convert or export the LoRA to a merged full checkpoint, or switch to a v1/v2 full sovits .pth which does not require a base model.
  4. If you maintain the runtime, pre-validate before init: if if_lora_v3 and not os.path.exists(path_sovits), surface a download instruction instead of letting FileNotFoundError propagate.

Example fix

# before
handler = TTS(config)  # crashes: FileNotFoundError ... SoVITS v3 底模缺失
handler.init_vits_weights("some_lora_v3.pth")

# after
# put s2Gv3/s2Dv3 base pth files in GPT_SoVITS/pretrained_models/s2Gv3.pth etc., then
handler = TTS(config)
handler.init_vits_weights("some_lora_v3.pth")  # loads and merges LoRA over base
Defensive patterns

Strategy: validation

Validate before calling

import os
from GPT_SoVITS.TTS_infer_pack.TTS import get_sovits_version_from_path_fast

version, model_version, if_lora = get_sovits_version_from_path_fast(sovits_path)
base_path = configs.default_configs[model_version]["vits_weights_path"]
if if_lora and not os.path.exists(base_path):
    raise SystemExit(f"missing base model {base_path} — download pretrained {model_version} weights first")

Type guard

def is_loadable_sovits(path: str, configs) -> bool:
    """True when path is a full checkpoint, or a lora with its base model present."""
    _, model_version, if_lora = get_sovits_version_from_path_fast(path)
    if not if_lora:
        return os.path.exists(path)
    return os.path.exists(configs.default_configs[model_version]["vits_weights_path"])

Try / catch

try:
    handler.init_vits_weights(sovits_path)
except FileNotFoundError as e:
    # message contains the expected base-model path; surface it with download instructions
    log.error("LoRA base model missing: %s — download pretrained sovits weights", e)

Prevention

When it happens

Trigger: Calling TTS.init_vits_weights(weights_path) (or any wrapper like infer_batch / TTS init with a LoRA path) where get_sovits_version_from_path_fast() returns if_lora_v3=True and os.path.exists(configs.default_configs[model_version]['vits_weights_path']) is False — i.e. a 'SoVITS_v3'/'SoVITS_v4' lora file with no pre-trained base model in GPT_SoVITS/pretrained_models.

Common situations: User downloads only a v3/v4 LoRA finetune from a model-sharing site and drops it into a fresh install without the s2Gv3/s2Dv3 (or v4) pretrained base files; renamed or moved pretrained_models directory; configs pointing to a custom base path that was deleted; partial downloads interrupted so the base .pth is missing.

Related errors


AI-assisted analysis of RVC-Boss/GPT-SoVITS@d523079fc0 (2026-08-15). Data as JSON: /api/errors/82c7f645621d3300. Report an issue: GitHub.