Skip to content

Fix: pretrained argument handling for dinov2 loading from torch hub#18

Open
barwojcik wants to merge 2 commits intocastacks:mainfrom
barwojcik:fix/hub-pretrained
Open

Fix: pretrained argument handling for dinov2 loading from torch hub#18
barwojcik wants to merge 2 commits intocastacks:mainfrom
barwojcik:fix/hub-pretrained

Conversation

@barwojcik
Copy link

This PR fixes the issue #17.

There is no way for dinov2 to not load pretrained weights from torch hub even if weights are loaded from separate checkpoint facebookresearch/map-anything#49.

Changes:

  • Added torch_hub_pretrained=True argument to DINOv2Encoder class.
  • Added logic that prevents weights download/loading if torch_hub_pretrained is set to False or pretrained_checkpoint_path is not None.
  • Added pretrained=False to torch.hub.load call in DUNEEncoder to prevent dinov2 weights being loaded/downloaded as checkpoint path is required to initialize the class.

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.

1 participant