fixed auto rope scaling (+1 squashed commits)

Squashed commits:

[b1767874] wip
This commit is contained in:
Concedo
2023-09-07 14:19:42 +08:00
parent 0bf75b05dc
commit 7fb809b94b
5 changed files with 42 additions and 28 deletions
+6 -6
View File
@@ -393,7 +393,7 @@ static std::string RemoveBell(const std::string & input) //removes the bell char
return word2;
}
ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in_file_format)
ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in_file_format, FileFormatExtraMeta file_format_meta)
{
ggml_time_init();
@@ -438,11 +438,11 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
{
//approximate NTK aware ctx
auto effectivenctx = params.n_ctx;
// if((file_format == FileFormat::GGUF_LLAMA || file_format==FileFormat::GGUF_FALCON) && llama_ctx_v4->model.hparams.n_ctx_train>2048)
// {
// float factor = llama_ctx_v4->model.hparams.n_ctx_train/2048;
// effectivenctx = effectivenctx/factor;
// }
if((file_format == FileFormat::GGUF_LLAMA || file_format==FileFormat::GGUF_FALCON) && file_format_meta.n_ctx_train > 2048)
{
float factor = file_format_meta.n_ctx_train/2048;
effectivenctx = effectivenctx/factor;
}
rope_freq_base = (effectivenctx <= 3072 ? 26000.0f : (effectivenctx <= 4096 ? 32000.0f : (effectivenctx <= 6144 ? 54000.0f : (effectivenctx <= 8192 ? 82684.0f : (effectivenctx <= 12288 ? 140000.0f : 200000.0f)))));
}