Browse Source

add verbose output if it's unable to create a model (#64)

Fangjun Kuang 2 years ago
parent
commit
029731d1ce
1 changed files with 18 additions and 0 deletions
  1. 18 0
      sherpa-ncnn/csrc/model.cc

+ 18 - 0
sherpa-ncnn/csrc/model.cc

@@ -125,6 +125,15 @@ std::unique_ptr<Model> Model::Create(const ModelConfig &config) {
     return std::make_unique<ConvEmformerModel>(config);
   }
 
+  NCNN_LOGE(
+      "Unable to create a model from specified model files.\n"
+      "Please check: \n"
+      "  1. If you are using a ConvEmformer model, please make sure you have "
+      "added SherapMetaData to encoder_xxx.ncnn.param "
+      "(or encoder_xxx.ncnn.int8.param if you are using an int8 model). "
+      "You need to add it manually after converting the model with pnnx.\n"
+      "  2. (Android) Whether the app requires an int8 model or not\n");
+
   return nullptr;
 }
 
@@ -148,6 +157,15 @@ std::unique_ptr<Model> Model::Create(AAssetManager *mgr,
     return std::make_unique<ConvEmformerModel>(mgr, config);
   }
 
+  NCNN_LOGE(
+      "Unable to create a model from specified model files.\n"
+      "Please check: \n"
+      "  1. If you are using a ConvEmformer model, please make sure you have "
+      "added SherapMetaData to encoder_xxx.ncnn.param "
+      "(or encoder_xxx.ncnn.int8.param if you are using an int8 model). "
+      "You need to add it manually after converting the model with pnnx.\n"
+      "  2. (Android) Whether the app requires an int8 model or not\n");
+
   return nullptr;
 }
 #endif