Hi community,
I've created a ONNX model that contains one simple LSTM (converted from a one-layer LSTM TF keras model via tf2onnx). I've converted it to DLC format via snpe-onnx-to-dlc. In this conversion, I encountered a bug (I believe) on activations but was able to workaround by modifying `lib/python/qti/aisw/converters/onnx/util.py` [1]. However I cannot quantize this LSTM DLC model further.
Command: snpe-dlc-quantize --input_dlc dlc/simple_lstm.w_states.dlc --input_list data/simple_lstm_ins.w_states.txt --verbose failed with error:
[INFO] InitializeStderr: DebugLog initialized.[INFO] Processed command-line arguments0.8ms [ INFO ] Initializing logging in the backend. Callback: [0xbfa5c0], Log Level: [3]2.5ms [ INFO ] No BackendExtensions lib provided;initializing NetRunBackend Interface4.3ms [ INFO ] Backend does not support asynchronous execution, defaulting to synchronous4.3ms [WARNING] Device with name = MainDevice does not exist[INFO] Quantized parameters9.5ms [ ERROR ] OpConfig validation failed for Lstm[ ERROR ] QnnModel::addNode() validating node LSTM__300 failed.7.6ms [ ERROR ] QnnModelOnlineSerializer::addNode Unable to add node LSTM__300 to QnnModel.7.6ms [ ERROR ] QuantizerRuntime::constructQnnModelOnline(): Failed to serialize model simple_lstm.w_states[ERROR] Invalid QnnModel constructed[INFO] DebugLog shutting down.
I am unable to trace what is the LSTM OpConfig is, and what of node LSTM__300 is incompliant. I'll attach the snpe-dlc-info output of the DLC model in below thread.
I'm using snpe-2.5.0.4052. Running on ubuntu with x86_64-linux-clang snpe sdk. Please suggest a solution. Thanks!
[1] LSTM ONNX->DLC conversion issue: ONNX LSTM attribute "activations" is ["b'Sigmoid'", "b'Tanh'", "b'Tanh'"] by default, but OnnxLSTMTranslation in lib/python/qti/aisw/converters/onnx/rnn_translations.py expects it to be ['Sigmoid', 'Sigmoid', 'Sigmoid', 'Tanh'] * 2, which is incorrect. So I modified util.py to get around this issue. Since the result DLC LSTM does not carry activation information as snpe-dlc-info reveals, I don't think this led to the original quantization error in post.
Here is the snpe-dlc-info output for the LSTM DLC model that cannot be quantized: