fastmachinelearning / hls4ml-tutorial

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

part 2 error: HLSModel must have tracing on #17

Closed arrow53 closed 3 years ago

arrow53 commented 3 years ago

in the second part of the tutorial for this line

hls4ml.model.profiling.numerical(model=model, hls_model=hls_model, X=X_test[:1000])

I see this error

RuntimeError: HLSModel must have tracing on for at least 1 layer (this can be set in its config)

When the config is generated do I need to pass a flag to enable tracing?

config = hls4ml.utils.config_from_keras_model(model, granularity='name')
thesps commented 3 years ago

Hi, I guess you are running the tutorial using hls4ml installed from the master branch, is that right? The profiling changed a little bit on master compared to the most recent release (which the tutorial still targets_, so I think that's why there is an error here.

You can enable tracing after creating the config like:

config = hls4ml.utils.config_from_keras_model(model, granularity='name')
for layer in config['LayerName'].keys():
    config['LayerName'][layer]['Trace'] = True
arrow53 commented 3 years ago

@thesps thanks. I went back to 0.5.0 so not an issue now but this is good to know for the future.

brtsfr commented 1 month ago

@thesps hi! may i ask the similar question that how to set Trace when i am using pytorch model?