SlowFast-Architecture on FPGA - Conversion from .pkl-File to .pth-File

Hello,

does anybody know how to convert a model given as .pkl-file into .pth?

in my master thesis I’m working on a solution to deploy a SlowFast-Network for human action recognition on an embedded platform with an FPGA. I use the open source codebase PySlowFast and have tested the inference on GPU already (just to see how it works). My embedded platform has an FPGA from Xilinx and I want to use Vitis AI from Xilinx for the quantization and compilation of the model.

The Vitis AI - quantizer needs a pre-trained PyTorch model, generally a .pth-file and a float model definition as input. The SlowFast-Network is saved as a .pkl-file. Does anybody know how I can get a .pth-file and a float model definition from this .pkl-file respectively from the PySlowFast codebase?

For example detectron offers a python skript to convert a model (.yaml and .pkl) to a model.pb. Do you maybe know a similar solution for PyTorch-Models?

Many thanks!

Hello,
I would be very sceptical of defining format from the extension. I myself saw lot’s of different ways of saving pytorch models of the same format with different extensions (though pytorch’s documentations suggests conventinal way).

Not 100% sure but it may end up that .pth and .pkl are refering to the same format.

1 Like

Hello Roman,

thanks for your reply. So you think I can maybe use the pkl file as input for the quantizer? Or do you think that I just need to re-save the file as pth? I hope I understood you correctly as I’m new to this topic. :sweat_smile:

Thank you