diff --git a/gpttype_adapter.cpp b/gpttype_adapter.cpp index d8a95267e..2f5ef76e8 100644 --- a/gpttype_adapter.cpp +++ b/gpttype_adapter.cpp @@ -484,8 +484,15 @@ void ContextRewind(std::vector &embd, std::vector ¤t_context_tok printf("\nWARNING: Don't use context rewind when in batch processing phase!\n"); return; } - bool is_recurrent = (file_format == FileFormat::GGUF_GENERIC && (file_format_meta.model_architecture==GGUFArch::ARCH_MAMBALIKE - || file_format_meta.model_architecture==GGUFArch::ARCH_RWKV)); + bool is_recurrent = false; + if(file_format==FileFormat::GGUF_GENERIC) + { + const llama_model * mdl = llama_get_model(llama_ctx_v4); + if(llama_model_is_recurrent(mdl) || llama_model_is_hybrid(mdl)) + { + is_recurrent = true; + } + } if(file_format == FileFormat::RWKV_1 || file_format==FileFormat::RWKV_2 || is_recurrent) { printf("\nWARNING: RNN models do not support context rewind!\n"); @@ -3747,8 +3754,15 @@ generation_outputs gpttype_generate(const generation_inputs inputs) printf("%s\n", RemoveBell(outstr).c_str()); } - bool is_recurrent = (file_format == FileFormat::GGUF_GENERIC && (file_format_meta.model_architecture==GGUFArch::ARCH_MAMBALIKE - || file_format_meta.model_architecture==GGUFArch::ARCH_RWKV)); + bool is_recurrent = false; + if(file_format==FileFormat::GGUF_GENERIC) + { + const llama_model * mdl = llama_get_model(llama_ctx_v4); + if(llama_model_is_recurrent(mdl) || llama_model_is_hybrid(mdl)) + { + is_recurrent = true; + } + } bool blank_prompt = (addedmemory=="" && kcpp_data->prompt==""); if (file_format == FileFormat::RWKV_1 || file_format==FileFormat::RWKV_2 || is_recurrent) diff --git a/model_adapter.cpp b/model_adapter.cpp index a3ca449d8..dec70c953 100644 --- a/model_adapter.cpp +++ b/model_adapter.cpp @@ -368,7 +368,7 @@ std::string gguf_get_model_arch(const std::string & gguf_filename) fileformatmeta->model_architecture = GGUFArch::ARCH_FALCON; } else if(modelarch=="mamba" || modelarch=="mamba2" || modelarch=="nemotron_h" || modelarch=="jamba" || modelarch=="granitehybrid" || modelarch=="lfm2" - || modelarch=="plamo2" || modelarch=="falcon-h1") //lazy approach, put all RNN models + || modelarch=="plamo2" || modelarch=="falcon-h1") //lazy approach, put all non rwkv RNN models { fileformatmeta->model_architecture = GGUFArch::ARCH_MAMBALIKE; }