mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-15 03:19:41 +00:00
fix for typical sampler
This commit is contained in:
parent
0c3a265187
commit
d7fed4732f
2 changed files with 9 additions and 2 deletions
|
@ -2663,7 +2663,10 @@ void llama_v3_sample_typical(struct llama_v3_context * ctx, llama_v3_token_data_
|
|||
|
||||
float entropy = 0.0f;
|
||||
for (size_t i = 0; i < candidates->size; ++i) {
|
||||
entropy += -candidates->data[i].p * logf(candidates->data[i].p);
|
||||
if(candidates->data[i].p>0)
|
||||
{
|
||||
entropy += -candidates->data[i].p * logf(candidates->data[i].p);
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the absolute difference between negative log probability and entropy for each candidate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue