Wsi-Caption icon indicating copy to clipboard operation
Wsi-Caption copied to clipboard

How to use the provided model checkpoint?

Open BanafshehKarimian opened this issue 1 year ago • 3 comments

Hello, thank you for providing the repo. However, I am having problems for using the ResNet based ckpt you have provided. The state_dict is different with the r2gen model you have. Could you please provide an example of how we can use this checkpoint to generate text given a histology image? Thank you in advance.

BanafshehKarimian avatar Jan 09 '25 22:01 BanafshehKarimian

have you included the following code?

resume_path = os.path.join(args.checkpoint_dir, 'model_best.pth')
print("Loading checkpoint: {} ...".format(resume_path))
checkpoint = torch.load(resume_path)['state_dict']
model_dict = model.state_dict()
state_dict = {k:v for k,v in checkpoint.items()}
model_dict.update(state_dict)
model.load_state_dict(model_dict)

cpystan avatar Jan 21 '25 12:01 cpystan

@BanafshehKarimian you could use model.load_state_dict(model_dict, strict=False) to get rid of unnecessary weights.

anhtienng avatar Feb 07 '25 06:02 anhtienng

Hello, thank you for providing the repo. However, I am having problems for using the ResNet based ckpt you have provided. The state_dict is different with the r2gen model you have. Could you please provide an example of how we can use this checkpoint to generate text given a histology image? Thank you in advance.

We find that the checkpoint we uploaded is wrong and should not be used for test. We are so sorry for our mistake. We will upload a new ckpt later.

cpystan avatar Feb 27 '25 09:02 cpystan