hls4ml icon indicating copy to clipboard operation
hls4ml copied to clipboard

Unable to convert custom tensorflow model using hls4ml

Open yrq0208 opened this issue 3 years ago • 0 comments

I am trying to convert a custom tensorflow model using hls4ml but I have encountered this error,

Traceback (most recent call last): File "/home/ruiqi/.local/lib/python3.7/site-packages/hls4ml/converters/tf_to_hls.py", line 136, in tf_to_hls graph_def.ParseFromString(f.read()) google.protobuf.message.DecodeError: Error parsing message with type 'tensorflow.GraphDef'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ruiqi/.local/bin/hls4ml", line 183, in main() File "/home/ruiqi/.local/bin/hls4ml", line 67, in main args.func(args) File "/home/ruiqi/.local/bin/hls4ml", line 135, in convert model = hls4ml.converters.convert_from_config(args.config) File "/home/ruiqi/.local/lib/python3.7/site-packages/hls4ml/converters/init.py", line 112, in convert_from_config model = tf_to_hls(yamlConfig) File "/home/ruiqi/.local/lib/python3.7/site-packages/hls4ml/converters/tf_to_hls.py", line 138, in tf_to_hls raise Exception('Error loading the graph definition: {}'.format(str(e))) Exception: Error loading the graph definition: Error parsing message with type 'tensorflow.GraphDef'

I wonder does it has anything to do with tensorflow version? This model I am trying to convert is developed using tensorflow 1.12. Upon googling this error, most of the answers just suggest using another way to load the tensorflow model, I am not sure I want to change the source code of hls4ml so I wonder can anyone shed some lights on this? I am using hls4ml 0.5.0

yrq0208 avatar Jun 14 '22 10:06 yrq0208