adjust malloc size for prompt_tokens

This commit is contained in:
Clemens Akens
2023-07-31 14:11:15 +02:00
parent f61807d6ea
commit 2c0134f669
+1 -1
View File
@@ -534,7 +534,7 @@ int main(int argc, char *argv[]) {
int *prompt_tokens = NULL;
int num_prompt_tokens = 0;
if (prompt != NULL) {
prompt_tokens = (int*)malloc(config.seq_len * sizeof(int));
prompt_tokens = (int*)malloc(strlen(prompt) * sizeof(int));
bpe_encode(prompt, vocab, vocab_scores, config.vocab_size, max_token_length, prompt_tokens, &num_prompt_tokens);
}