Glow: [ONNXImporter] Message print when folding failed

Created on 6 May 2020  路  5Comments  路  Source: pytorch/glow

When compiling a ONNX model with a LSTM node the CLI tool prints the following message:

I0506 13:45:28.624825 16840 ONNXModelLoader.cpp:4070] Error while trying to ConstantFold lstm_1: 
Error message: No node under name 
Error return stack:
/home/osboxes/Desktop/Shared/glow_upstream/glow/lib/Importer/ProtobufLoader.cpp:175
/home/osboxes/Desktop/Shared/glow_upstream/glow/lib/Importer/ONNXModelLoader.cpp:2490
/home/osboxes/Desktop/Shared/glow_upstream/glow/lib/Importer/ONNXModelLoader.cpp:4069

The bundle seems to be generated properly and after investigating the source it seems that it is not an error but merely a print from:
https://github.com/pytorch/glow/blob/644d26f58c3dbe56e5d9b7ccc50031a01c300f3b/lib/Importer/ONNXModelLoader.cpp#L4069-L4071
@jfix71 Can you confirm that this is not a problem? If not I think it is better to remove the message because one of our clients complained that his model cannot be compiled. Even though it seems it does but for some people this message is very misleading. Also I'm curious why the logic is trying to perform constant folding on an operator which does not have all of its inputs as constants?

Most helpful comment

@jfix71 Thanks for solving this "problem" 馃槃

All 5 comments

Can you confirm that this is not a problem? If not I think it is better to remove the message because one of our clients complained that his model cannot be compiled. Even though it seems it does but for some people this message is very misleading.

Yeah, it's not a problem insomuch as we've made constant folding best effort, so if the model successfully compiles even though there's a constant folding error then it should be fine (though if we should have been able to constant fold something then there's extra work done at inference time that we didn't need to do).

Perhaps we should just update the message we log here? E.g. "Unable to ConstantFold, " << loadOperatorName(op)". And then we can add a VLOG for the error stack in case someone wants to see it. WDYT?

Also I'm curious why the logic is trying to perform constant folding on an operator which does not have all of its inputs as constants?

I'm also curious 馃檪 if you can gather a repro for this it'd be good. It seems like it expects to find some constant registered under an empty name? Not sure what's going on.

@jfix71 I'm not very familiar with the error handling/reporting types. I see there's a lot of types in Glow. For now it would suffice I think not to print the message by default. Is there such a thing LOG(DEBUG) to change to?
What do you mean by repro?

VLOG doesn't print by default -- you provide a verbosity level and it only prints depending on a verbosity level --v specified on the command line.

By repro I just meant some way to reproduce the issue, so we can root cause and fix it.

CC: @ksaurabh-cadence @tlepley-cadence

@jfix71 You can reproduce the "problem" for this model: lstm.zip
Using the model-compiler like this:

model-compiler -model=lstm.onnx -backend=CPU -emit-bundle=bundle -onnx-define-symbol=N,1

which produces the console text:

WARNING: Logging before InitGoogleLogging() is written to STDERR
I0511 10:51:56.659029 14469 ONNXModelLoader.cpp:4070] Error while trying to ConstantFold lstm_1: 
Error message: No node under name 
Error return stack:
/home/osboxes/Desktop/Shared/glow_upstream/glow/lib/Importer/ProtobufLoader.cpp:175
/home/osboxes/Desktop/Shared/glow_upstream/glow/lib/Importer/ONNXModelLoader.cpp:2490
/home/osboxes/Desktop/Shared/glow_upstream/glow/lib/Importer/ONNXModelLoader.cpp:4069

although the bundle is generated.

@jfix71 Thanks for solving this "problem" 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

georgeokelly picture georgeokelly  路  4Comments

stoklund picture stoklund  路  5Comments

ayermolo picture ayermolo  路  3Comments

wayneshawn picture wayneshawn  路  3Comments

mciprian13 picture mciprian13  路  4Comments