train-CLIP icon indicating copy to clipboard operation
train-CLIP copied to clipboard

customwrapped load checkpoint test

Open tonyhuang33 opened this issue 3 years ago • 2 comments

I have some problems about how to load checkpoing with Customwrapped. Could give some code example to me? I would be very grateful to you

tonyhuang33 avatar Jul 06 '22 08:07 tonyhuang33

I trained with CustomCLIPWrapper, and successfully loaded checkpoints. Here my code for this

    img_encoder = resnet50(pretrained=False)
    img_encoder.fc = torch.nn.Linear(2048, 768)

    txt_encoder = AutoModel.from_pretrained("vinai/phobert-base")

    model = CustomCLIPWrapper(img_encoder, txt_encoder, 64, avg_word_embs=True)

    checkpoint = torch.load(ckpt_path)
    model.load_state_dict(checkpoint["state_dict"])

lamducanhndgv avatar Sep 13 '22 07:09 lamducanhndgv

这是来自QQ邮箱的假期自动回复邮件。   您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

tonyhuang33 avatar Sep 13 '22 07:09 tonyhuang33