wenet-e2e / wekws

Production First and Production Ready End-to-End Keyword Spotting Toolkit
Apache License 2.0
455 stars 111 forks source link

About c++11 Using smart Pointers causes source code error protection problems #170

Open xyz666888 opened 3 months ago

xyz666888 commented 3 months ago

In this file onnxruntime_cxx_api.h

If I use version 1.12.x and below

char LookupCustomMetadataMap(const char key , OrtAllocator* allocator )const;

///< Wraps OrtApi :: ModelMetadataLookupCustomMetadataMap

This may allow the current source code to compile correctly However, when the Onnxruntime version is greater than 1.13.0, the version number is different. For details, see the official website In most cases, version number 6 will be used,1.12.x or later cannot be loaded effectively, and Android will run in a flash. For instance, terminating with uncaught exception of type Ort::Exception: inference_session.cc:1086 LoadOrtModel The ORT format model version [6] is not supported this build 1.12.1

no member error occurs when I try to upgrade Because the functions I mentioned above have been deprecated in the new version

// namespace wekws /home/xiao/apk_example/android/app/src/main/cpp/kws/keyword_spotting.cc:38:35: error: no member named 'LookupCustomMetadataMap' in 'Ort::ModelMetadata'

AllocatedStringPtr LookupCustomMetadataMapAllocated(const char key , OrtAllocator allocator) const; ///< Wraps OrtApi :: ModelMetadataLookupCustomMetadataMap

This made me very upset and tried to change the source code to cachedim = std::stoi(metadata.LookupCustomMetadataMapAllocated("cache_dim", allocator).get());

To my regret, an error that I suspect is out of memory was reported

terminating with uncaught exception of type Ort::Exception: Got invalid dimensions for input: input for the following indices index: 2 Got: 80 Expected: 40

Sent from PPHub

xyz666888 commented 3 months ago

) 8C61A5779C1DE464B01B0E5BF30AD627 8CF419C4459B3EB10984878AE0E52439

The first image is Onnxruntime 1.13.x and above, and the second image is version 1.12.x and below