浏览代码

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

Fangjun Kuang 2 年之前
父节点
当前提交
029731d1ce
共有 1 个文件被更改,包括 18 次插入0 次删除
  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