-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to load the torch models from internet if there is bad network connection? #47
Comments
I have tried to download the corresponding weights from github to my local machine, and scp it to the server and modify your code to: from torchvision.models import vit_b_16
if 'dino' in model_type:
model_path = '/path/to/ckpt/dino_vitbase16_pretrain_full_checkpoint.pth'
if os.path.exists(model_path):
model = vit_b_16(pretrained=True)
state_dict = torch.load(model_path)
model.load_state_dict(state_dict)
model.eval()
else:
model = torch.hub.load('facebookresearch/dino:main', model_type) But it seems that the backbone cannot match with the weights, with some keys missing. |
I also tried to use model_dir = '~/.cache/torch/checkpoints' # I have a hubconf.py and the weights dino_vitbase16_pretrain_full_checkpoint.pth under the directory
model_name = 'vit_b_16'
model = torch.hub.load(model_dir, model=model_name, source='local') which also encountered into error in lerf/lerf/data/utils/dino_extractor.py Line 128 in 3b2cb90
|
Hi, I am having the same problem. Have you fixed that? |
Sorry about that, but I haven't fixed that. |
Thank you for your great work!
When trying to extract dino features, we need to load model from github through the code:
lerf/lerf/data/utils/dino_extractor.py
Lines 67 to 82 in 3b2cb90
but I cannot find a way to do that without available network. Do you have any alternative methods?
The text was updated successfully, but these errors were encountered: