Stability-AI/generative-models · error · ValueError
Cannot find {}
Error message
Cannot find {} What it means
After passing the mutual-exclusion check, main.py verifies that the path given to -r/--resume actually exists on disk. If os.path.exists(opt.resume) is False it raises this ValueError before attempting to load anything, so a typo or moved checkpoint fails fast instead of deep inside checkpoint loading.
Source
Thrown at main.py:561
# running as `python main.py`
# (in particular `main.DataModuleFromConfig`)
sys.path.append(os.getcwd())
parser = get_parser()
opt, unknown = parser.parse_known_args()
if opt.name and opt.resume:
raise ValueError(
"-n/--name and -r/--resume cannot be specified both."
"If you want to resume training in a new log folder, "
"use -n/--name in combination with --resume_from_checkpoint"
)
melk_ckpt_name = None
name = None
if opt.resume:
if not os.path.exists(opt.resume):
raise ValueError("Cannot find {}".format(opt.resume))
if os.path.isfile(opt.resume):
paths = opt.resume.split("/")
# idx = len(paths)-paths[::-1].index("logs")+1
# logdir = "/".join(paths[:idx])
logdir = "/".join(paths[:-2])
ckpt = opt.resume
_, melk_ckpt_name = get_checkpoint_name(logdir)
else:
assert os.path.isdir(opt.resume), opt.resume
logdir = opt.resume.rstrip("/")
ckpt, melk_ckpt_name = get_checkpoint_name(logdir)
print("#" * 100)
print(f'Resuming from checkpoint "{ckpt}"')
print("#" * 100)
opt.resume_from_checkpoint = ckpt
base_configs = sorted(glob.glob(os.path.join(logdir, "configs/*.yaml")))View on GitHub (pinned to e8cd657656)
Solutions
- Run `ls <path>` to verify the checkpoint path exists and correct the -r/--resume argument.
- Use an absolute path for --resume, or launch from the same working directory used originally.
- In containers/cluster jobs, mount or copy the directory containing the checkpoint and point --resume at the mounted path.
Example fix
// before python main.py --base cfg.yaml -r logs/run1/checkpoints/last.ckpt # run1 was renamed // after python main.py --base cfg.yaml -r logs/run1_renamed/checkpoints/last.ckpt
Defensive patterns
Strategy: validation
Validate before calling
import os, sys
resume = next((sys.argv[i+1] for i, a in enumerate(sys.argv) if a in ('-r', '--resume')), None)
if resume and not os.path.exists(resume):
raise SystemExit(f"Checkpoint not found: {os.path.abspath(resume)}") Prevention
- Always pass absolute checkpoint paths to --resume.
- Verify the checkpoint path exists (os.path.exists) before submitting cluster jobs.
- Mount the logs volume in containers before resuming.
When it happens
Trigger: Running with `-r /path/to/ckpt` where that path does not exist: checkpoint deleted or moved, wrong relative path from the launch working directory, or a container/mount that does not include the logs directory.
Common situations: Resuming after logs were archived or renamed; running from a different working directory so a relative path no longer resolves; submitting a SLURM/K8s job without mounting the volume holding the checkpoint; trailing whitespace or shell variable left empty in the path.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
AI-assisted analysis of Stability-AI/generative-models@e8cd657656 (2026-08-29).
Data as JSON: /api/errors/9e86205af7451485.
Report an issue: GitHub.