deepinsight/insightface · error · FileNotFoundError
Model file '{model_name}' not found in downloaded repository
Error message
Model file '{model_name}' not found in downloaded repository What it means
After snapshot_download(..., allow_file_pattern=[model_name]) returns, _download_from_modelscope expects the requested file at cache_dir/model_name; if the model repository doesn't contain a file with that exact name, FileNotFoundError is raised. It usually means a wrong model name or a repo layout mismatch.
Source
Thrown at cpp-package/inspireface/python/inspireface/modules/utils/resource.py:133
str: Path to the downloaded model file
"""
if not MODELSCOPE_AVAILABLE:
raise ImportError("ModelScope is not available. Please install it with: pip install modelscope")
print(f"Downloading model '{model_name}' from ModelScope...")
try:
# Download specific model file from ModelScope
cache_dir = snapshot_download(
model_id=self.modelscope_model_id,
cache_dir=str(self.modelscope_cache_dir),
allow_file_pattern=[model_name] # Only download the specific model file
)
model_file_path = Path(cache_dir) / model_name
if not model_file_path.exists():
raise FileNotFoundError(f"Model file '{model_name}' not found in downloaded repository")
print(f"ModelScope download completed: {model_file_path}")
return str(model_file_path)
except Exception as e:
raise RuntimeError(f"Failed to download model from ModelScope: {e}")
def get_model(self, name: str, re_download: bool = False, ignore_verification: bool = False) -> str:
"""
Get model path. Download if not exists or re_download is True.
Args:
name: Model name
re_download: Force re-download if True
ignore_verification: Skip model hash verification if True
Returns:
str: Full path to model fileView on GitHub (pinned to 7fadd420c2)
Solutions
- Check the ModelScope repo file listing and use the exact filename
- If upstream renamed files, upgrade inspireface so _MODEL_LIST maps to current names, or pin a known-good modelscope snapshot revision
- As a fallback, download the file manually and place it in the models cache dir, then call get_model with re_download=False
Example fix
# before
path = resource.get_model('pikachu-v2') # file not in repo
# after — inspect repo files, use exact name
path = resource.get_model('pikachu') Defensive patterns
Strategy: validation
Validate before calling
valid = list(resource._MODEL_LIST.keys()) assert model_name in valid or (Path(cache_dir) / model_name).exists(), model_name
Try / catch
try:
path = resource.get_model(name)
except FileNotFoundError as e:
log.error('check repo file listing; names: %s', list(resource._MODEL_LIST))
raise Prevention
- Use names from the registry verbatim
- Pin package + modelscope revisions so repo layout can't drift
When it happens
Trigger: Calling get_model(name) with a name whose mapped file doesn't exist in the ModelScope repo — typos, renamed upstream files, or case-sensitivity mismatches between the requested filename and the repo contents.
Common situations: Upstream ModelScope repo restructured/renamed model files; user passes a model name string that isn't in the local mapping (forwarded anyway in modelscope mode); locale/case differences in filenames.
Related errors
- ModelScope is not available. You have two options: 1. Instal
- ModelScope is not available. Please install it with: pip ins
- Failed to download model from ModelScope: {e}
- Failed to launch InspireFace automatically
- Failed to download model: {e}
AI-assisted analysis of deepinsight/insightface@7fadd420c2 (2026-08-28).
Data as JSON: /api/errors/a465cb47e5492162.
Report an issue: GitHub.