We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 85286f3 commit 1cbd80fCopy full SHA for 1cbd80f
examples/simple/simple.cpp
@@ -145,6 +145,20 @@ int main(int argc, char ** argv) {
145
146
llama_batch batch = llama_batch_get_one(prompt_tokens.data(), prompt_tokens.size());
147
148
+ if (llama_model_has_encoder(model)) {
149
+ if (llama_encode(ctx, batch)) {
150
+ fprintf(stderr, "%s : failed to eval\n", __func__);
151
+ return 1;
152
+ }
153
+
154
+ llama_token decoder_start_token_id = llama_model_decoder_start_token(model);
155
+ if (decoder_start_token_id == LLAMA_TOKEN_NULL) {
156
+ decoder_start_token_id = llama_vocab_bos(vocab);
157
158
159
+ batch = llama_batch_get_one(&decoder_start_token_id, 1);
160
161
162
// main loop
163
164
const auto t_main_start = ggml_time_us();
0 commit comments