Disable is_bugged check

This commit is contained in:
Aleksandras Kostarevas 2024-04-29 22:19:49 -04:00
parent 474839f60b
commit 85de4c86d4

View File

@ -558,7 +558,7 @@ struct LanguageModelState {
float *logits = llama_get_logits_ith(ctx, decodeResult.logits_head); float *logits = llama_get_logits_ith(ctx, decodeResult.logits_head);
//AKLOGI("Value of [the ] before transform: %f", logits[561]); //AKLOGI("Value of [the ] before transform: %f", logits[561]);
bool is_bugged = logits[561] == 0.0f; //bool is_bugged = logits[561] == 0.0f;
if(!transform_logits(logits, n_vocab, true, allow_correction_token, capitals, 0)) { if(!transform_logits(logits, n_vocab, true, allow_correction_token, capitals, 0)) {
AKLOGE("logits have NaN!"); AKLOGE("logits have NaN!");
@ -566,13 +566,13 @@ struct LanguageModelState {
} }
// TODO: This should really not be here // TODO: This should really not be here
is_bugged = is_bugged && logits[561] < -990.0f && logits[561] > -1100.0f; //is_bugged = is_bugged && logits[561] < -990.0f && logits[561] > -1100.0f;
if(is_bugged) { //if(is_bugged) {
AKLOGE("Detected bug!!!! Trying to mitigate. Let's just reset cache and exit"); // AKLOGE("Detected bug!!!! Trying to mitigate. Let's just reset cache and exit");
llama_kv_cache_seq_rm(ctx, -1, -1, -1); // llama_kv_cache_seq_rm(ctx, -1, -1, -1);
model->transformerContext.active_context = { }; // model->transformerContext.active_context = { };
return { }; // return { };
} //}
//AKLOGI("Value of [the ] after transform: %f", logits[561]); //AKLOGI("Value of [the ] after transform: %f", logits[561]);
@ -603,19 +603,19 @@ struct LanguageModelState {
} }
// TODO: This should really not be here // TODO: This should really not be here
is_bugged = true; //is_bugged = true;
for(const auto &seq : sequences) { //for(const auto &seq : sequences) {
if(seq.second.tokens.front() > 48 || seq.first != sequences[0].first) { // if(seq.second.tokens.front() > 48 || seq.first != sequences[0].first) {
is_bugged = false; // is_bugged = false;
break; // break;
} // }
} //}
if(is_bugged) { //if(is_bugged) {
AKLOGE("Detected bug2!!!! Trying to mitigate. Let's just reset cache and exit"); // AKLOGE("Detected bug2!!!! Trying to mitigate. Let's just reset cache and exit");
llama_kv_cache_seq_rm(ctx, -1, -1, -1); // llama_kv_cache_seq_rm(ctx, -1, -1, -1);
model->transformerContext.active_context = { }; // model->transformerContext.active_context = { };
return { }; // return { };
} //}
for (auto &sequence: sequences) { for (auto &sequence: sequences) {