Skip to content

Fix OpenMidnight loader crash from dinov2 hub - #1

Open
Dojo2024 wants to merge 9 commits into
MedARC-AI:mainfrom
Dojo2024:fix/openmidnight-dinov2-pretrained-loader
Open

Dojo2024 wants to merge 9 commits into
MedARC-AI:mainfrom
Dojo2024:fix/openmidnight-dinov2-pretrained-loader

Conversation

@Dojo2024

@Dojo2024 Dojo2024 commented Sep 25, 2026 •

Copy link
Copy Markdown

Summary

  • get_openmidnight() in src/thunder/models/pretrained_models.py builds the DINOv2 ViT-g/14 backbone via torch.hub.load("facebookresearch/dinov2", "dinov2_vitg14_reg", weights=None), relying on weights=None to skip loading Meta's pretrained LVD-142M weights before the OpenMidnight checkpoint is loaded manually on top.
  • dinov2's hub code on main now defaults pretrained=True regardless of weights, and only skips that branch when pretrained=False is passed explicitly. With just weights=None, it falls through to convert_path_or_url_to_url(None) and crashes:
    TypeError: argument should be a str or an os.PathLike object where __fspath__ returns a str, not 'NoneType'
    
  • This means the currently-registered openmidnight model in THUNDER fails to load in a fresh environment, before it ever reaches the checkpoint.

@CLAassistant

CLAassistant commented Sep 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 3 committers have signed the CLA.

❌ Debojyoti Das
❌ sofiene-boutaj
❌ PierreMarza


Debojyoti Das seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

get_openmidnight() built the DINOv2 ViT-g/14 backbone via
torch.hub.load("facebookresearch/dinov2", "dinov2_vitg14_reg", weights=None),
relying on weights=None to skip fetching Meta's pretrained weights before the
OpenMidnight checkpoint is loaded manually on top. dinov2's hub code on main
now defaults pretrained=True regardless of weights, and only skips the
pretrained-weights branch when pretrained=False is passed explicitly.
Passing weights=None without pretrained=False falls through to
convert_path_or_url_to_url(None), which crashes with:

  TypeError: argument should be a str or an os.PathLike object where
  __fspath__ returns a str, not 'NoneType'

This breaks the existing openmidnight support in a fresh environment. Fixed
by passing pretrained=False directly, which is what was actually intended.

Verified by running `thunder benchmark openmidnight break_his knn` end to
end after the fix (previously crashed at model load).
@Dojo2024
Dojo2024 force-pushed the fix/openmidnight-dinov2-pretrained-loader branch from d07bcd9 to ad30080 Compare September 25, 2026 19:50
@Dojo2024 Dojo2024 changed the title Fix OpenMidnight loader crash from dinov2 hub API change Fix OpenMidnight loader crash from dinov2 hub Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants