huzi96 / Coarse2Fine-PyTorch

70 stars 6 forks source link

a quick question on ".pk" files #12

Open JXuann opened 2 years ago

JXuann commented 2 years ago

Hi, I am wondering why you use .pk file for saving the weights, as opposed to .pth or .pt commonly seen for saving trained pytorch models? Many thank in advance!

huzi96 commented 2 years ago

This is because my original implementation is based on TensorFlow, hence the weights are actually TensorFlow tensors. I saved the weights with pickle, and the file name extension reflects that. I implemented a conversion tool and every time you run the test it maps the weights to PyTorch tensors, see https://github.com/huzi96/Coarse2Fine-PyTorch/blob/921fcefda8205c9790c5172777a3ec371b2a6c7e/networks.py#L636