Sometimes I see .bin files for pretrained pytorch, like the one here
https://github.com/allenai/scibert#pytorch-models
However, the files are usually saved as .pt files.
What's the difference between these two parameter weights file formats? Why are there two?
A common PyTorch convention is to save tensors using . pt file extension. PyTorch preserves storage sharing across serialization. See Saving and loading tensors preserves views for more details. The 1.6 release of PyTorch switched torch.
A common PyTorch convention is to save models using either a .pt or .pth file extension. Remember that you must call model.eval() to set dropout and batch normalization layers to evaluation mode before running inference. Failing to do this will yield inconsistent inference results.
There is no difference as it's just an extension. When it comes to UNIX-like OSes one can open the file no matter the extension (see here), Windows on the other hand is built with them in mind (here).
torch
can read either .bin
or .pt
or .anything
so it's probably convention employed by the creators of that repository.
Standard approach is to use .pt
or .pth
, though the second extension collides with Python's text file readable by interpreter, so .pt
seems the best idea for now (see this github issue).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With