@@ -29,62 +29,38 @@ class ET_EXPERIMENTAL LlavaRunner
2929 const std::string& tokenizer_path,
3030 const float temperature = 0 .8f )
3131 : MultimodalRunner(model_path, tokenizer_path, temperature){};
32- bool is_loaded ();
33- ::executorch::runtime::Error load ();
32+
33+ bool is_loaded () override ;
34+
35+ ::executorch::runtime::Error load () override ;
36+
3437 ::executorch::runtime::Error generate (
3538 std::vector<::executorch::extension::llm::Image> images,
3639 const std::string& prompt,
3740 int32_t seq_len = 1024 ,
3841 std::function<void (const std::string&)> token_callback = {},
3942 std::function<void (const ::executorch::extension::llm::Stats&)>
4043 stats_callback = {},
41- bool echo = true );
44+ bool echo = true ) override ;
4245
43- /* *
44- * Prefill an LLaVA Module with the given images input.
45- * @param images The image input to LLaVA.
46- * @param start_pos The starting position in KV cache of the input in the LLM.
47- * It's passed as reference and will be updated inside this function.
48- * @return The error status of prefilling images.
49- */
5046 ::executorch::runtime::Error prefill_images (
5147 std::vector<::executorch::extension::llm::Image>& images,
52- int64_t & start_pos);
48+ int64_t & start_pos) override ;
5349
54- /* *
55- * Prefill an LLaVA Module with the given text input.
56- * @param prompt The text prompt to LLaVA.
57- * @param start_pos The starting position in KV cache of the input in the LLM.
58- * It's passed as reference and will be updated inside this function.
59- * @param bos The number of BOS (begin of sequence) token.
60- * @param eos The number of EOS (end of sequence) token.
61- * @return The generated token of the LLaVA Module after prefill prompt.
62- */
6350 ::executorch::runtime::Result<uint64_t > prefill_prompt (
6451 const std::string& prompt,
6552 int64_t & start_pos,
6653 int8_t bos = 0 ,
67- int8_t eos = 0 );
54+ int8_t eos = 0 ) override ;
6855
69- /* *
70- * Generate tokens from the given prompt, starting from the given position.
71- * @param prompt The text prompt to LLaVA.
72- * @param seq_len The total sequence length, including the prompt tokens and
73- * new tokens.
74- * @param start_pos The starting position in KV cache of the input in the LLM.
75- * @param token_callback What to do after a token is generated.
76- * @param stats_callback What to do with Stats.
77- * @param echo Whether to echo the input prompt or not.
78- * @return The error code.
79- */
8056 ::executorch::runtime::Error generate_from_pos (
8157 const std::string& prompt,
8258 int32_t seq_len = 1024 ,
8359 int64_t start_pos = 0 ,
8460 std::function<void (const std::string&)> token_callback = {},
8561 std::function<void (const ::executorch::extension::llm::Stats&)>
8662 stats_callback = {},
87- bool echo = true );
63+ bool echo = true ) override ;
8864
8965 private:
9066 inline static const std::string kPresetPrompt =
0 commit comments