Merge pull request #195 from clebert/prompt-tokens-size
Adjust `malloc` size for `prompt_tokens`
This commit is contained in:
@@ -533,7 +533,7 @@ int main(int argc, char *argv[]) {
|
|||||||
int *prompt_tokens = NULL;
|
int *prompt_tokens = NULL;
|
||||||
int num_prompt_tokens = 0;
|
int num_prompt_tokens = 0;
|
||||||
if (prompt != NULL) {
|
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);
|
bpe_encode(prompt, vocab, vocab_scores, config.vocab_size, max_token_length, prompt_tokens, &num_prompt_tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user