Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions gpttype_adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1540,13 +1540,10 @@ void sample_entropy(llama_token_data_array * cur_p, float min_temp, float max_te

void sample_temperature(llama_token_data_array * candidates_p, float temp, float smoothing_factor, float smoothing_curve)
{
bool isgreedy = false;
if (temp <= 0)
{
// Imitate greedy sampling
temp = 0.00390625f; //cannot be zero else div0, this is 1/256
smoothing_factor = 0;
isgreedy = true;
sample_top_k(candidates_p, 1); //only want first candidate
return;
}

for (size_t i = 0; i < candidates_p->size; ++i) {
Expand All @@ -1565,11 +1562,6 @@ void sample_temperature(llama_token_data_array * candidates_p, float temp, float
}
sample_softmax(candidates_p);
}

if(isgreedy)
{
sample_top_k(candidates_p, 1); //only want first candidate
}
}

void sample_grammar(FileFormat file_format, int32_t n_vocab, llama_token_data_array * candidates, const struct llama_grammar * grammar) {
Expand Down