From c9e1446f525088261e6cf649c3a9d47ebeef4a7f Mon Sep 17 00:00:00 2001 From: Phillip Kravtsov Date: Tue, 26 Sep 2023 00:07:19 -0700 Subject: [PATCH] correct tensors thru RoPE --- ggml.c | 6 +++--- llama.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ggml.c b/ggml.c index 2f02865fc..3cf682ab9 100644 --- a/ggml.c +++ b/ggml.c @@ -12729,8 +12729,8 @@ static void ggml_compute_forward_rope_f32( if (strncmp(src0->name, "qrot", 4) == 0 && params->ith == 0) { GGML_PRINT("\nValues at RoPE time for %s\n", src0->name); ggml_print_tensor(src0); - int starts[] = {0, 0, 1, 0}; - ggml_print_tensor_values(src0, starts, 1, 10); + int starts[] = {0, 1, 0, 0}; + ggml_print_tensor_values(src0, starts, 0, 10); } float freq_base; @@ -12863,7 +12863,7 @@ static void ggml_compute_forward_rope_f32( if (strncmp(src0->name, "qrot", 4) == 0 && params->ith == 0) { GGML_PRINT("\n dest at RoPE time for %s\n", src0->name); // print shape and strides - int starts[4] = {0,0,0,0}; + int starts[4] = {0,0,1,0}; ggml_print_tensor(dst); ggml_print_tensor_values(dst, starts, 0, 10); } diff --git a/llama.cpp b/llama.cpp index a8a724c2c..31f92cad2 100644 --- a/llama.cpp +++ b/llama.cpp @@ -3945,13 +3945,13 @@ static struct ggml_cgraph * llm_build_adept( struct ggml_tensor * qrotated = ggml_cont(ctx0, ggml_permute(ctx0, ggml_rope_custom_inplace( - ctx0, qrot, n_past, n_rot, 0, 0, freq_base, freq_scale + ctx0, qrot, n_past, n_rot, 2, 0, freq_base, freq_scale ), 2, 1, 0, 3 )); struct ggml_tensor * krotated = ggml_cont(ctx0, ggml_permute(ctx0, ggml_rope_custom_inplace( - ctx0, krot, n_past, n_rot, 0, 0, freq_base, freq_scale + ctx0, krot, n_past, n_rot, 2, 0, freq_base, freq_scale ), 2, 1, 0, 3 ));