How to know if model is half or full precision?

Is there a way to find if a model is a half-precision or full precision model?

1 Like

By default PyTorch will initialize all tensors and parameters with ‚Äúsingle precision‚ÄĚ, i.e. float32.
If you are not using the mixed precision training utilities or are calling .half(), to(torch.float16)etc. in your code, the model should stay in FP32.

To check it, you could iterate all parameters (and buffers) and print their dtype:

for param in model.parameters():
    print(param.dtype)
5 Likes