Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Is it possible to get full imagenet pretrained weights of MoCo v2 ? #573

Closed
CharlieCheckpt opened this issue Oct 3, 2022 · 2 comments
Closed

Comments

@CharlieCheckpt
Copy link

CharlieCheckpt commented Oct 3, 2022

❓ Is it possible to get full imagenet pretrained weights of MoCo v2 ?

Hello,
Thank you for this nice library.

I am trying to get the entire weights of resnet50 pretrained with moco v2 on ImageNet dataset. That is, I need the two encoders, the head etc ... so that I can resume the training with moco.

Is is possible to do this using the weights from the model zoo or somewhere else ?

I downloaded the weights and it does not seem to contain the weights of the two encoders.

@CharlieCheckpt CharlieCheckpt changed the title Is it possible to get full imagenet pretrained weights of MoCo v2 Is it possible to get full imagenet pretrained weights of MoCo v2 ? Oct 3, 2022
@QuentinDuval
Copy link
Contributor

Hello @CharlieCheckpt,

Thanks a lot for your question :)

Following your question, I checked the content of our model zoo for MoCo V2 and downloaded the weights available here:
https://dl.fbaipublicfiles.com/vissl/model_zoo/moco_v2_1node_lr.03_step_b32_zero_init/model_final_checkpoint_phase199.torch

Those weights are indeed complete and contain the weights of the trunk, the head, the momentum encoder, the queue, basically everything needed to restart training from there.

cp = torch.load("/path/to/model_final_checkpoint_phase199.torch")

# head
cp["classy_state_dict"]["base_model"]["model"]["heads"].keys()

# trunk
cp["classy_state_dict"]["base_model"]["model"]["trunk"].keys()

# loss (containing the momentum encoder)
cp['loss'].keys()

Please tell me if this answers your question,
Thank you,
Quentin

@CharlieCheckpt
Copy link
Author

Hi @QuentinDuval , it does, sorry for some reason I couldn't find it.

Thank you !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants