RVC-Boss/GPT-SoVITS · error · ValueError

Error: Unknown model type. If you are using a model without

Error message

Error: Unknown model type. If you are using a model without a configuration file, Ensure that your model name includes 'bs_roformer', 'bsroformer', 'mel_band_roformer', or 'melbandroformer'. Otherwise, you can manually place the model configuration file into 'tools/uvr5/uvr5w_weights' and ensure that the configuration file is named as '<model_name>.yaml' then try it again.

What it means

This ValueError is raised by the BSRoformer wrapper's __init__ (tools/uvr5/bsroformer.py:277) when it cannot determine the architecture of a downloaded Roformer separation model. Model type is first inferred from substrings in the model filename ('bs_roformer'/'bsroformer' or 'mel_band_roformer'/'melbandroformer'); if none match and no YAML configuration file exists at the expected config_path, the wrapper has no way to build the model, so it aborts immediately. The error is purely about naming/config discovery, not about corrupted weights or CUDA issues.

Source

Thrown at tools/uvr5/bsroformer.py:277

            except:
                pass

    def __init__(self, model_path, config_path, device, is_half):
        self.device = device
        self.is_half = is_half
        self.model_type = None
        self.config = None

        # get model_type, first try:
        if "bs_roformer" in model_path.lower() or "bsroformer" in model_path.lower():
            self.model_type = "bs_roformer"
        elif "mel_band_roformer" in model_path.lower() or "melbandroformer" in model_path.lower():
            self.model_type = "mel_band_roformer"

        if not os.path.exists(config_path):
            if self.model_type is None:
                # if model_type is still None, raise an error
                raise ValueError(
                    "Error: Unknown model type. If you are using a model without a configuration file, Ensure that your model name includes 'bs_roformer', 'bsroformer', 'mel_band_roformer', or 'melbandroformer'. Otherwise, you can manually place the model configuration file into 'tools/uvr5/uvr5w_weights' and ensure that the configuration file is named as '<model_name>.yaml' then try it again."
                )
            self.config = self.get_default_config()
        else:
            # if there is a configuration file
            self.config = self.get_config(config_path)
            if self.model_type is None:
                # if model_type is still None, second try, get model_type from the configuration file
                if "freqs_per_bands" in self.config["model"]:
                    # if freqs_per_bands in config, it's a bs_roformer model
                    self.model_type = "bs_roformer"
                else:
                    # else it's a mel_band_roformer model
                    self.model_type = "mel_band_roformer"

        print("Detected model type: {}".format(self.model_type))
        model = self.get_model_from_config()
        state_dict = torch.load(model_path, map_location="cpu")

View on GitHub (pinned to d523079fc0)

Solutions

  1. Rename the checkpoint file so its name contains a recognized architecture substring, e.g. 'model_bs_roformer_ep0173.ckpt' or 'vocals_mel_band_roformer.ckpt' — then no YAML is needed because get_default_config() supplies one.
  2. Alternatively, keep the original filename and place the model's YAML config in tools/uvr5/uvr5w_weights named exactly '<model_name>.yaml' (same basename as the .ckpt); the config branch will infer the type from the presence of 'freqs_per_bands'.
  3. Re-download the model from its official UVR/HuggingFace source without renaming, so the architecture substring and any companion YAML are preserved.
  4. If you drive BSRoformer programmatically, verify the derived config_path exists before constructing, and point config_path at the correct YAML instead of relying on the default location.

Example fix

// before (in tools/uvr5/uvr5w_weights)
//   vocals_best.ckpt          <- no architecture substring, no YAML -> ValueError

// after (option A: rename the file)
//   vocals_best_bs_roformer.ckpt

// after (option B: keep name, add matching YAML)
//   vocals_best.ckpt
//   vocals_best.yaml          <- copied from the model's official config
Defensive patterns

Strategy: validation

Validate before calling

import os

WEIGHTS_DIR = "tools/uvr5/uvr5w_weights"
ARCH_SUBSTRINGS = ("bs_roformer", "bsroformer", "mel_band_roformer", "melbandroformer")

def validate_roformer_model(model_path):
    """Return (ok, detail). Checks the exact conditions that trigger the ValueError."""
    name = os.path.basename(model_path).lower()
    config_path = os.path.join(WEIGHTS_DIR, os.path.basename(model_path).rsplit(".", 1)[0] + ".yaml")
    has_arch_name = any(s in name for s in ARCH_SUBSTRINGS)
    has_config = os.path.exists(config_path)
    if not has_arch_name and not has_config:
        return False, (
            f"'{os.path.basename(model_path)}' has no architecture substring "
            f"and no config at '{config_path}'. Rename the file to include "
            f"one of {ARCH_SUBSTRINGS} or place a '<model_name>.yaml' beside it."
        )
    return True, "ok"

Type guard

def is_recognized_roformer_checkpoint(model_path: str) -> bool:
    """Narrowing check mirroring BSRoformer.__init__ first-try logic."""
    name = model_path.lower()
    return ("bs_roformer" in name or "bsroformer" in name
            or "mel_band_roformer" in name or "melbandroformer" in name)

Try / catch

from tools.uvr5.bsroformer import BSRoformer

try:
    roformer = BSRoformer(model_path, config_path, device, is_half)
except ValueError as e:
    if "Unknown model type" in str(e):
        # Naming/config problem: fix the filename or ship the YAML, then retry.
        raise RuntimeError(
            f"Cannot load '{model_path}': rename it to include "
            "bs_roformer/bsroformer/mel_band_roformer/melbandroformer, "
            f"or provide '{config_path}'."
        ) from e
    raise  # unrelated ValueError, do not swallow

Prevention

When it happens

Trigger: Constructing BSRoformer(model_path, config_path, device, is_half) (or selecting a Roformer model in the UVR5 web UI) where: (1) model_path's basename contains none of the four recognized substrings (case-insensitive), AND (2) os.path.exists(config_path) is False — i.e. there is no '<model_name>.yaml' sitting next to the weights in tools/uvr5/uvr5w_weights. Typical concrete cases: a checkpoint renamed to 'my_vocal_model.ckpt', a file downloaded as 'model_v2X.ckpt' with the architecture name stripped, or the companion YAML placed in the wrong directory / named differently from the .ckpt basename.

Common situations: Users of RVC/Retrieval-based-Voice-Conversion-WebUI (or the bundled tools/uvr5 package) dropping a manually downloaded UVR Roformer checkpoint into the weights folder. Many HuggingFace/UVR releases ship the .ckpt and its .yaml as separate downloads, and users grab only the .ckpt, rename it for tidiness, or let the browser dedupe/strip the name. Older repo versions also had different default weight directories, so models carried over from a previous install hit the missing-config branch.


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