Fix ROPE accuracy when freq_scale != 1
This commit is contained in:
parent
602f9ca4af
commit
1a38339cea
|
|
@ -319,12 +319,8 @@ static bool is_op_unsupported_case(const ggml_tensor* op) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
float freq_scale;
|
float freq_scale;
|
||||||
memcpy(&freq_scale, op_params + 6, sizeof(float));
|
|
||||||
if (freq_scale != 0.0f && freq_scale != 1.0f) {
|
|
||||||
GGML_LOG_WARN("OpenVINO backend does not support ROPE with freq_scale %f != 1.0f\n", freq_scale);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
float ext_factor;
|
float ext_factor;
|
||||||
|
memcpy(&freq_scale, op_params + 6, sizeof(float));
|
||||||
memcpy(&ext_factor, op_params + 7, sizeof(float));
|
memcpy(&ext_factor, op_params + 7, sizeof(float));
|
||||||
if (ext_factor != 0.0f) {
|
if (ext_factor != 0.0f) {
|
||||||
GGML_LOG_WARN("OpenVINO backend does not support ROPE with ext_factor %f != 0.0f\n", ext_factor);
|
GGML_LOG_WARN("OpenVINO backend does not support ROPE with ext_factor %f != 0.0f\n", ext_factor);
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ std::pair<ov::Output<Node>, ov::Output<Node>> make_sin_cos(int32_t* rope_params,
|
||||||
ggml_rope_yarn_corr_dims(n_dims, n_ctx_orig, freq_base, beta_fast, beta_slow, corr_dims);
|
ggml_rope_yarn_corr_dims(n_dims, n_ctx_orig, freq_base, beta_fast, beta_slow, corr_dims);
|
||||||
|
|
||||||
std::vector<float> factor(n_dims / 2);
|
std::vector<float> factor(n_dims / 2);
|
||||||
factor[0] = freq_scale;
|
factor[0] = 1.0f;
|
||||||
for (size_t i = 1; i < factor.size(); i++) {
|
for (size_t i = 1; i < factor.size(); i++) {
|
||||||
factor[i] = theta_scale * factor[i - 1];
|
factor[i] = theta_scale * factor[i - 1];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue