Closed rajeshpandit107 closed 1 year ago
Configuration is meant to be tweaked. You decide how deep you want to go with tweaking. Maybe you just want to specify one precision for the whole model, or maybe you want to specify that one particular layer is going to use specific precision to store intermediate multiplication values. Granularity helps with making that initial configuration.
Can We synthesize a single layer of a given model(for example first convolution layer of Lenet 5 architecture) using 'name' or 'type' granularity or any other method?
hls4ml synthesizes whole models, if you only want to synthesize one layer, create a model with only one layer.
Thanks for that quick reply. How much time did it take to synthesize a large CNN model in version 0.5.0 version of hls4ml(The CNN model that has been given as reference in the second published paper of hls4ml) ?
Hi @rajeshpandit107! The model takes roughly 45-90 minutes to synthesise, depending on your CPU.
hi @thaarres , I am trying to regenerate a similar cnn model, but my synthesis neither completes nor gives any error, it gets stuck for 4-5 days. Could you please help me with the way to define synthesis configuration ?
I am using a 3 GHz intel Xeon CPU with a ram of 32GB
Hi @rajeshpandit107. This sounds strange. Could you provide further details on what your model is/what your hls4ml configuration is set to? You can find an example configuration at
https://github.com/thaarres/hls4ml_cnns/blob/master/doScans.py#L61
Hi @thaarres , I tried re-synthesizing the model, I could not succeed. Could you please see the configuration file and point out the incorrect configuration paramters vivado_hls.log model.py.log
I am giving the following configuration : **import hls4ml import plotting hls4ml.model.optimizer.OutputRoundingSaturationMode.layers = ['Activation'] hls4ml.model.optimizer.OutputRoundingSaturationMode.rounding_mode = 'AP_RND' hls4ml.model.optimizer.OutputRoundingSaturationMode.saturation_mode = 'AP_SAT'
config = hls4ml.utils.config_from_keras_model(model, granularity='name',default_reuse_factor=2000) config['LayerName']['softmax']['exp_table_t'] = 'ap_fixed<18,8>' config['LayerName']['softmax']['inv_table_t'] = 'ap_fixed<18,4>' hls_model = hls4ml.converters.convert_from_keras_model(model, hls_config=config, output_dir='Paper_model/hls4ml_prj', fpga_part='xcu250-figd2104-2L-e') hls_model.compile() y_qkeras = model.predict(X_test) y_hls = hls_model.predict(X_test)**
Hi @rajeshpandit107 !
You need to set cfg['IOType'] = 'io_stream'
.
See example at
https://github.com/thaarres/hls4ml_cnns/blob/master/doScans.py#L49
Can someone please explain the use of granularity while defining the model configuration?