Skip to content

Commit 3547b4b

Browse files
committed
More fixes
1 parent d07df5a commit 3547b4b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

common/speculative.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ llama_tokens common_speculative_gen_draft(
155155
const int i_start = std::max<int>(0, (int) prompt_tgt.size() - n_ctx);
156156

157157
// Extract parameters packed in p_min (format: 0.pmin_pdecay_nmin)
158-
const float p_min = floorf(params_p_min * 100) / 100; // First 2 decimal places
159-
const float p_decay = floorf((params_p_min - p_min) * 10000) / 100; // Next 2 decimal places
160-
const int n_min = floorf((params_p_min - p_min - (p_decay / 100)) * 100000); // Last digit
158+
const float p_min = floorf(params.p_min * 100) / 100; // First 2 decimal places
159+
const float p_decay = floorf((params.p_min - p_min) * 10000) / 100; // Next 2 decimal places
160+
const int n_min = floorf((params.p_min - p_min - (p_decay / 100)) * 100000); // Last digit
161161

162162
printf("p_min=%f, p_decay=%f, n_min=%d\n", p_min, p_decay, n_min);
163163

@@ -275,7 +275,7 @@ llama_tokens common_speculative_gen_draft(
275275

276276
sequence_p *= cur_p->data[0].p;
277277

278-
const float threshold_p = p_min * pow(std::max((int) result.size() - std::max(n_min, 1), 1), -p_decay);
278+
const float threshold_p = p_min * pow(std::max((int) result.size() - std::max(n_min, 1) + 1, 1), -p_decay);
279279

280280
printf("sequence_p=%f, threshold_p=%f\n", sequence_p, threshold_p);
281281

0 commit comments

Comments
 (0)