lukemelas / EfficientNet-PyTorch

A PyTorch implementation of EfficientNet
Apache License 2.0
7.91k stars 1.53k forks source link

half / mixed precision? #291

Open jacekpoplawski opened 3 years ago

jacekpoplawski commented 3 years ago

Is it possible to use EfficientNet-PyTorch with half / mixed precision somehow? I know the mixed precision is supported by PyTorch for about a year, but what about pretrained weights?

ekurtulus commented 3 years ago

In Pytorch, you can convert the pretrained weights into torch.half16 with the following way: model.half()

but this is not the recommended way. Instead you have to use torch.cuda.amp.autocast while training.

For more details