Zasder3 / train-CLIP

A PyTorch Lightning solution to training OpenAI's CLIP from scratch.
MIT License
653 stars 78 forks source link

customwrapped load checkpoint test #35

Open tonyhuang33 opened 2 years ago

tonyhuang33 commented 2 years ago

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

lamducanhndgv commented 2 years ago

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"])
tonyhuang33 commented 2 years ago

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