@@ -915,11 +915,20 @@ bool ModelLoader::init_from_gguf_file(const std::string& file_path, const std::s
915915
916916 size_t total_size = 0 ;
917917 size_t data_offset = gguf_get_data_offset (ctx_gguf_);
918+
918919 for (int i = 0 ; i < n_tensors; i++) {
919920 std::string name = gguf_get_tensor_name (ctx_gguf_, i);
920921 struct ggml_tensor * dummy = ggml_get_tensor (ctx_meta_, name.c_str ());
921922 size_t offset = data_offset + gguf_get_tensor_offset (ctx_gguf_, i);
922923
924+ if (i==0 && starts_with (name,prefix)){
925+ LOG_WARN (" Tensors have built-in %s prefix.\n " , prefix);
926+ if (prefix == " model.diffusion_model." ){
927+ // the user probably used `--diffusion-model` instead of `-m`
928+ LOG_WARN (" Try using `-m`or `--model` instead of `--diffusion-model`\n " );
929+ }
930+ }
931+
923932 // LOG_DEBUG("%s", name.c_str());
924933
925934 TensorStorage tensor_storage (prefix + name, dummy->type , dummy->ne , ggml_n_dims (dummy), file_index, offset);
@@ -1000,6 +1009,7 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const
10001009
10011010 nlohmann::json header_ = nlohmann::json::parse (header_buf.data ());
10021011
1012+ int i =0 ;
10031013 for (auto & item : header_.items ()) {
10041014 std::string name = item.key ();
10051015 nlohmann::json tensor_info = item.value ();
@@ -1050,6 +1060,14 @@ bool ModelLoader::init_from_safetensors_file(const std::string& file_path, const
10501060 n_dims = 1 ;
10511061 }
10521062
1063+ if (i++==0 && starts_with (name,prefix)){
1064+ LOG_WARN (" Tensors have built-in %s prefix.\n " , prefix);
1065+ if (prefix == " model.diffusion_model." ){
1066+ // the user probably used `--diffusion-model` instead of `-m`
1067+ LOG_WARN (" Try using `-m`or `--model` instead of `--diffusion-model`\n " );
1068+ }
1069+ }
1070+
10531071 TensorStorage tensor_storage (prefix + name, type, ne, n_dims, file_index, ST_HEADER_SIZE_LEN + header_size_ + begin);
10541072 tensor_storage.reverse_ne ();
10551073
@@ -1433,6 +1451,13 @@ bool ModelLoader::init_from_ckpt_file(const std::string& file_path, const std::s
14331451 {
14341452 std::string name = zip_entry_name (zip);
14351453 size_t pos = name.find (" data.pkl" );
1454+ if (i==0 && starts_with (name,prefix)){
1455+ LOG_WARN (" Tensors have built-in %s prefix.\n " , prefix);
1456+ if (prefix == " model.diffusion_model." ){
1457+ // the user probably used `--diffusion-model` instead of `-m`
1458+ LOG_WARN (" Try using `-m`or `--model` instead of `--diffusion-model`\n " );
1459+ }
1460+ }
14361461 if (pos != std::string::npos) {
14371462 std::string dir = name.substr (0 , pos);
14381463 printf (" ZIP %d, name = %s, dir = %s \n " , i, name.c_str (), dir.c_str ());
0 commit comments