Using pkl file for inference

Hi,

I am trying to segment a CT data using a pretrained model. The paper and code I am following is this (GitHub - ICT-MIRACLE-lab/CTPelvic1K: Resources of the paper “Deep Learning to Segment Pelvic Bones: Large-scale CT Datasets and Baseline Models”.). The author provides pretrained model in the format of .pkl. They have also provided model_best.model file. I am not able to load the model in the .pkl format. Most of the documentation I went through uses .pth format.

Is there any method of converting .pkl file to .pth format?

What kind of error do you get when trying to load the .pkl file?
I’m not sure if the files really differ, since only the file extension is using another naming. You could also save a state_dict using any custom extension as seen here, which won’t change the underlying data structure:

lin = nn.Linear(1, 1)
torch.save(lin.state_dict(), "lin.my_custom_extension_format")

lin = nn.Linear(1, 1)
lin.load_state_dict(torch.load('lin.my_custom_extension_format'))
> <All keys matched successfully>