|
|
@@ -16066,6 +16066,13 @@ static int llama_decode_internal(
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
+ for (uint32_t i = 0; i < n_tokens_all; ++i) {
|
|
|
+ if (batch_all.token[i] < 0) {
|
|
|
+ LLAMA_LOG_ERROR("%s: invalid token[%d] = %d", __func__, i, batch_all.token[i]);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const auto & model = lctx.model;
|
|
|
const auto & hparams = model.hparams;
|
|
|
const auto & cparams = lctx.cparams;
|
|
|
@@ -16358,6 +16365,13 @@ static int llama_encode_internal(
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
+ for (uint32_t i = 0; i < n_tokens; ++i) {
|
|
|
+ if (batch.token[i] < 0) {
|
|
|
+ LLAMA_LOG_ERROR("%s: invalid token[%d] = %d", __func__, i, batch.token[i]);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
const auto & model = lctx.model;
|
|
|
const auto & hparams = model.hparams;
|
|
|
const auto & cparams = lctx.cparams;
|