google / qkeras

QKeras: a quantization deep learning library for Tensorflow Keras
Apache License 2.0
532 stars 102 forks source link

How to save and load quantized models ? #67

Closed febinpsunny closed 3 years ago

febinpsunny commented 3 years ago

I am using model_save_quantized_weights() and load_qmodles(), as suggested in: https://notebook.community/google/qkeras/notebook/QKerasTutorial But, I keep getting: NameError: name 'model_save_quantized_weights' is not defined

I installed qkeras in Anaconda using:!pip install git+git://github.com/google/qkeras And I import stuff as: from qkeras import * Quantized models, themselves work fine. Its saving and loading thats got me stumped.

I worked around the Name Error by basically copy pasting the module definition from source code into my notebook. But I cant find the code for load_qmodel() ?

Why am I getting this error ? Am I missing something ?

febinpsunny commented 3 years ago

After somemore snooping I figured out I should be using: from qkeras.utils import model_save_quantized_weights and from qkeras.utils import load_qmodel()

Is there a load_qweights() utility function or something similar as well ? To load the saved weights ?

zhuangh commented 3 years ago

Hi @codegit001, firstly, thank you for the feedback.

Could you use keras load_weights directly? The weights are already quantized, so load_weights should do the job.

zhuangh commented 3 years ago

it has been a while. close it. please feel free to re-open it if you encounter issue.