Skip to content

Commit 4e9e319

Browse files
committed
test-thread-safety : handle tiny training context of the input model
1 parent 2ca720c commit 4e9e319

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test-thread-safety.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,14 @@ int main(int argc, char ** argv) {
131131
}
132132

133133
batch = llama_batch_get_one(&token, 1);
134-
if (llama_decode(ctx.get(), batch)) {
134+
135+
int ret = llama_decode(ctx.get(), batch);
136+
if (ret == 1 && i > 0) {
137+
LOG_INF("Context full, stopping generation.\n");
138+
break;
139+
}
140+
141+
if (ret != 0) {
135142
LOG_ERR("Model %d/%d, Context %d/%d: failed to decode\n", m + 1, num_models, c + 1, num_contexts);
136143
failed.store(true);
137144
return;

0 commit comments

Comments
 (0)