Add other workaround

This commit is contained in:
Aleksandras Kostarevas 2024-03-13 16:11:52 -05:00
parent 45c49c5625
commit 38055fae65

View File

@ -556,6 +556,7 @@ struct LanguageModelState {
return { };
}
// TODO: This should really not be here
is_bugged = is_bugged && logits[561] < -990.0f && logits[561] > -1100.0f;
if(is_bugged) {
AKLOGE("Detected bug!!!! Trying to mitigate. Let's just reset cache and exit");
@ -592,6 +593,22 @@ struct LanguageModelState {
);
}
// TODO: This should really not be here
is_bugged = true;
for(const auto &seq : sequences) {
if(seq.second.tokens.front() > 48 || seq.first != sequences[0].first) {
is_bugged = false;
break;
}
}
if(is_bugged) {
AKLOGE("Detected bug2!!!! Trying to mitigate. Let's just reset cache and exit");
llama_kv_cache_seq_rm(ctx, -1, -1, -1);
model->transformerContext.active_context = { };
return { };
}
for (auto &sequence: sequences) {
if (sequence.second.seq_id == 0) continue;