Xilinx / LSTM-PYNQ

BSD 3-Clause "New" or "Revised" License
86 stars 29 forks source link

how to use the trained .tar output from pytorch #6

Open eejlny opened 5 years ago

eejlny commented 5 years ago

Hello,

I have used the framework available in https://github.com/Xilinx/pytorch-ocr to trained a quantized network and this has produced a .tar output.

I would like to know how can I transform the contents of this tar file with weight/bias parameters to use them here. I can see that the parameters are set in r_model_fw_rw.hpp but how can I get these parameters from the output of the training process ?

For example depending on the number of PE/SIMD the way the parameters are loaded changes as well.

Thanks,

ussamazahid96 commented 5 years ago

You can export the trained model from .tar using

python main.py -i <path to .tar> -p <path to quantized parameters used for training> --export

but do compare the generated r_fw_bw file with the one given in this repo for a few parameters e.g. NUMBER_OF_NEURONS_TYPEWIDTH, HEIGHT_IN_PIX_TYPEWIDTH.