Skip to content

fix(simple): report missing weights file cleanly instead of traceback in verify #294

Closed

Description

@agarwalpranav0711

Description

In simple/ovl.py, passing a nonexistent file path to --weights in verify causes load_weights to crash with an unhandled FileNotFoundError traceback:

Traceback (most recent call last):
  File "simple/ovl.py", line 620, in cmd_verify
    sd = load_weights(a.weights)
  File "simple/ovl.py", line 544, in load_weights
    return torch.load(path, map_location="cpu", weights_only=True)
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent.pt'

Proposed Fix

In load_weights(path) in simple/ovl.py, check whether the specified file exists before attempting to load it:

if not Path(path).exists():
    sys.exit(f"weights {path} not found")

This would allow missing weights files to exit cleanly with an informative error message, matching how the rest of cmd_verify handles missing input files.

AI Usage Disclosure

  • Identified with Gemini 3.8 Flash via Google Antigravity IDE.
  • Reproduced locally and confirmed the FileNotFoundError behavior.

Activity

  1. agarwalpranav0711 commented on Nov 2, 2026

    @agarwalpranav0711
    ContributorAuthor

    I'd like to work on this!

  2. agarwalpranav0711 commented on Nov 2, 2026

    @agarwalpranav0711
    ContributorAuthor

    Closing: I noticed maintainer @ryoari already implemented this in open PR #281 (if a.weights and not Path(a.weights).is_file(): sys.exit(...)). Looking forward to #281 merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions