fastmachinelearning / hls4ml

Machine learning on FPGAs using HLS
https://fastmachinelearning.org/hls4ml
Apache License 2.0
1.17k stars 388 forks source link

TypeError: 'NoneType' object is not subscriptable #1027

Open zsrabbani opened 3 days ago

zsrabbani commented 3 days ago

I have a qkeras model. When I load model(load_qmodel) and I want to compile it I get this error. I installed the last version of HLS4ML libarary.

Code: model_path = 'weights-chkpt-11-0.657679.h5' model = load_qmodel(model_path) model.summary()

Result: image image

HLS Code: import hls4ml

hls_config = hls4ml.utils.config_from_keras_model(model, granularity='model') hls_config['Model']['ReuseFactor']=16 hls_config['Model']['Strategy']='Resource'

hls_config['LayerName']['output']['exp_table_t'] = 'ap_fixed<16,6>' hls_config['LayerName']['output']['inv_table_t'] = 'ap_fixed<16,6>' hls_config['LayerName']['output']['Strategy'] = 'Stable'

cfg = hls4ml.converters.create_config(backend='Vivado') cfg['IOType'] = 'io_stream'
cfg['HLSConfig'] = hls_config cfg['KerasModel'] = model cfg['OutputDir'] = 'CNN_16_6_16_q' hls_model = hls4ml.converters.convert_from_keras_model(hls_config=cfg, backend='VivadoAccelerator', part='xczu7ev-ffvc1156-2-e')

hls_model.compile() print('NOW is finished')

Result:

image

image

I appreciate for your response.

vloncar commented 3 days ago

I think this is fixed by #997. The model however is too large for hls4ml and won't work.

zsrabbani commented 2 days ago

So because of large model I can not use the hls4ml?