Skip to content

Commit 912e624

Browse files
committed
Apply suggestions to main.cpp
1 parent b0ed03b commit 912e624

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

main.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ int main(int argc, char ** argv) {
9898

9999
// Add a space in front of the first character to match OG llama tokenizer behavior
100100
params.prompt.insert(0, 1, ' ');
101-
// tokenize the prompt
102-
std::vector<gpt_vocab::id> embd_inp = llama_tokenize_text(ctx, params.prompt);
103101

104102
// prefix & suffix for instruct mode
105103
const std::vector<gpt_vocab::id> inp_pfx = ::llama_tokenize(vocab, "\n\n### Instruction:\n\n", true);
@@ -161,15 +159,15 @@ int main(int argc, char ** argv) {
161159
printf(ANSI_COLOR_YELLOW);
162160
}
163161

164-
if(!llama_injest_input(ctx, params.prompt))
162+
if(!llama_ingest_input(ctx, params.prompt))
165163
{
166-
fprintf(stderr, "Failed to injest prompt\n");
164+
fprintf(stderr, "Failed to ingest prompt\n");
167165
return 1;
168166
};
169167

170168
// display text
171169
input_noecho = false;
172-
const std::vector<gpt_vocab::id>& embd = llama_context_get_embd(ctx);
170+
const std::vector<gpt_vocab::id>& embd = llama_context_get_embedding(ctx);
173171
if (!input_noecho) {
174172
for (auto id : embd) {
175173
printf("%s", vocab.id_to_token[id].c_str());
@@ -183,9 +181,9 @@ int main(int argc, char ** argv) {
183181

184182
const std::vector<gpt_vocab::id>& last_n_tokens = llama_context_get_last_n_tokens(ctx);
185183

186-
while (llama_context_not_finished(ctx) > 0) {
184+
while (llama_context_is_finished(ctx) != true) {
187185
gpt_vocab::id model_output = 0;
188-
bool response = llama_inference(ctx, model_output);
186+
bool response = llama_infer(ctx, model_output);
189187
if (response) {
190188
printf("%s", vocab.id_to_token[model_output].c_str());
191189
fflush(stdout);
@@ -195,7 +193,6 @@ int main(int argc, char ** argv) {
195193
printf(ANSI_COLOR_RESET);
196194
}
197195

198-
199196
// in interactive mode, and not currently processing queued inputs;
200197
// check if we should prompt the user for more
201198
if (params.interactive) {
@@ -228,7 +225,7 @@ int main(int argc, char ** argv) {
228225
line.pop_back(); // Remove the continue character
229226
}
230227
// Do not clear existing context in interactive mode
231-
llama_init_context_with_prompt(ctx, buf, false);
228+
llama_update_context_with_prompt(ctx, buf, false);
232229
}
233230

234231
remaining_tokens -= line_inp.size();

0 commit comments

Comments
 (0)