RVC-Boss/GPT-SoVITS · error · FileNotFoundError
Files not found: {paths}
Error message
Files not found: {paths} What it means
FileNotFoundError from _find_first_existing_file(): g2pw initialization probes several absolute/relative candidate paths for a required model file (the .onnx / tokenizer assets) and returns the first that exists; if none exist it raises with the whole candidate list. It is the multi-path variant of [13] and almost always means the G2PWModel assets were never downloaded to any searched location.
Source
Thrown at GPT_SoVITS/text/g2pw/onnx_api.py:71
return all_preds, all_confidences
def _load_json_from_candidates(filename: str, candidate_dirs: List[str]) -> Dict[str, Any]:
for candidate_dir in candidate_dirs:
if not candidate_dir:
continue
json_path = os.path.join(candidate_dir, filename)
if os.path.exists(json_path):
with open(json_path, "r", encoding="utf-8") as fr:
return json.load(fr)
raise FileNotFoundError(f"Cannot locate {filename} in candidate dirs: {candidate_dirs}")
def _find_first_existing_file(*paths: str) -> str:
for path in paths:
if path and os.path.exists(path):
return path
raise FileNotFoundError(f"Files not found: {paths}")
def download_and_decompress(model_dir: str = "G2PWModel/"):
if not os.path.exists(model_dir):
parent_directory = os.path.dirname(model_dir)
zip_dir = os.path.join(parent_directory, "G2PWModel_1.1.zip")
extract_dir = os.path.join(parent_directory, "G2PWModel_1.1")
extract_dir_new = os.path.join(parent_directory, "G2PWModel")
print("Downloading g2pw model...")
modelscope_url = "https://www.modelscope.cn/models/kamiorinn/g2pw/resolve/master/G2PWModel_1.1.zip"
with requests.get(modelscope_url, stream=True) as r:
r.raise_for_status()
with open(zip_dir, "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
if chunk:
f.write(chunk)
print("Extracting g2pw model...")View on GitHub (pinned to d523079fc0)
Solutions
- Run the provided downloader (download_and_decompress('G2PWModel/')) or manually fetch G2PWModel_1.1.zip and extract so at least one probed path exists.
- Run from the repository root or pass absolute model_dir so relative candidate paths resolve.
- Check each path in the error message and create/ symlink the model at one of them.
- If g2pw is optional for you, ensure the frontend falls back to pypinyin instead of hard-requiring g2pw.
Example fix
# before
# FileNotFoundError: Files not found: ('G2PWModel/chinese-ert-base.onnx', ...)
converter = G2POnnxConverter()
# after
from GPT_SoVITS.text.g2pw.onnx_api import download_and_decompress
download_and_decompress("GPT_SoVITS/text/g2pw/G2PWModel/")
converter = G2POnnxConverter(model_dir="GPT_SoVITS/text/g2pw/G2PWModel/") Defensive patterns
Strategy: validation
Validate before calling
import os
if not any(p and os.path.exists(p) for p in candidate_paths):
from GPT_SoVITS.text.g2pw.onnx_api import download_and_decompress
download_and_decompress("GPT_SoVITS/text/g2pw/G2PWModel/") Try / catch
try:
model_path = _find_first_existing_file(*paths)
except FileNotFoundError:
download_and_decompress("GPT_SoVITS/text/g2pw/G2PWModel/")
model_path = _find_first_existing_file(*paths) Prevention
- Run g2pw model download as a provisioning step, not at first request.
- Use absolute model_dir and run from repo root so all candidate paths resolve.
- Cache the resolved path after first success to skip probing.
When it happens
Trigger: G2POnnxConverter init resolving the onnx model path: every probed path (default GPT_SoVITS/text/g2pw/G2PWModel/... variants) fails os.path.exists().
Common situations: Fresh install where download step was skipped; Chinese TTS frontend enabled (zh language triggers g2pw) without the model bundle; model directory renamed; running from a different cwd so relative candidates miss.
Related errors
- Cannot locate {filename} in candidate dirs: {candidate_dirs}
- SoVITS %s 底模缺失,无法加载相应 LoRA 权重
- {path_sovits}SoVITS {model_version}底模缺失,无法加载相应 LoRA 权重
- {path_sovits}SoVITS {model_version}底模缺失,无法加载相应 LoRA 权重
AI-assisted analysis of RVC-Boss/GPT-SoVITS@d523079fc0 (2026-08-15).
Data as JSON: /api/errors/16c51a86a3ef3ac7.
Report an issue: GitHub.