fastmachinelearning / hls4ml-tutorial

Tutorial notebooks for hls4ml
http://fastmachinelearning.org/hls4ml-tutorial/
285 stars 123 forks source link

2nd tutorial does not seem to work #4

Closed eejlny closed 3 years ago

eejlny commented 3 years ago

Hello,

I am using tensorflow 2.3.1. I completed the first tutorial but the second tutorial fails with the config line. It seems that granulary 'name' is the problem:

config = hls4ml.utils.config_from_keras_model(model, granularity='Name') File "/hdd2/programs/prunning/tensorflow/lib/python3.6/site-packages/hls4ml/utils/config.py", line 200, in config_from_keras_model layer_config = make_layer_config(layer) File "/hdd2/programs/prunning/tensorflow/lib/python3.6/site-packages/hls4ml/utils/config.py", line 147, in make_layer_config if layer['config']['activation'] == 'softmax': KeyError: 'config'

Also on tutorial 1 the network is using a 16 bit precision:

{'Model': {'Precision': 'ap_fixed<16,6>', 'ReuseFactor': 1, 'Strategy': 'Latency'}}

but the accuracy reported is very low for hls4ml:

Keras Accuracy: 0.7500542168674699 hls4ml Accuracy: 0.20060240963855422

eejlny commented 3 years ago

seems that my enviroment was not correct. I have replicated yours and it works now. Sorry and thanks.