Skip to content

Commit 5cabbd1

Browse files
committed
Rebased on top of recent changes
Reviewed By: cccclai
1 parent 5b377a2 commit 5cabbd1

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

examples/qualcomm/oss_scripts/llama/runner/runner.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ Error Runner<T>::generate(
323323
return generate_from_pos(prompt, 0, config, token_callback, stats_callback);
324324
}
325325

326-
Error Runner::generate_from_pos(
326+
template <typename T>
327+
Error Runner<T>::generate_from_pos(
327328
const std::string& prompt,
328329
int64_t start_pos,
329330
const llm::GenerationConfig& config,
@@ -334,7 +335,8 @@ Error Runner::generate_from_pos(
334335
prompt, false, config, token_callback, stats_callback);
335336
}
336337

337-
Error Runner::generate_from_prompt_or_file(
338+
template <typename T>
339+
Error Runner<T>::generate_from_prompt_or_file(
338340
const std::string& prompt,
339341
bool tokenized_prompt,
340342
const llm::GenerationConfig& config,

extension/android/CMakeLists.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,18 +180,19 @@ if(EXECUTORCH_BUILD_LLAMA_JNI)
180180
)
181181

182182
target_sources(
183-
executorch_jni PRIVATE
184-
${EXECUTORCH_ROOT}/extension/llm/runner/llm_runner_helper.cpp
183+
executorch_jni
184+
PRIVATE ${EXECUTORCH_ROOT}/extension/llm/runner/llm_runner_helper.cpp
185185
)
186186

187187
target_include_directories(
188-
executorch_jni PRIVATE
189-
${EXECUTORCH_ROOT}/extension/llm/runner
188+
executorch_jni
189+
PRIVATE ${EXECUTORCH_ROOT}/extension/llm/runner
190190
)
191191

192192
if(QNN_SDK_ROOT)
193193
target_sources(
194-
executorch_jni PRIVATE
194+
executorch_jni
195+
PRIVATE
195196
${EXECUTORCH_ROOT}/examples/qualcomm/oss_scripts/llama/runner/runner.cpp
196197
${EXECUTORCH_ROOT}/examples/qualcomm/oss_scripts/llama/runner/decoder_runner.cpp
197198
${EXECUTORCH_ROOT}/examples/qualcomm/oss_scripts/llama/runner/prompt_processor.cpp
@@ -202,8 +203,8 @@ if(EXECUTORCH_BUILD_LLAMA_JNI)
202203
)
203204

204205
target_include_directories(
205-
executorch_jni PRIVATE
206-
${EXECUTORCH_ROOT}/examples/qualcomm/oss_scripts/llama/runner
206+
executorch_jni
207+
PRIVATE ${EXECUTORCH_ROOT}/examples/qualcomm/oss_scripts/llama/runner
207208
)
208209
target_compile_definitions(executorch_jni PRIVATE EXECUTORCH_BUILD_QNN=1)
209210
endif()

extension/android/jni/jni_layer_llama.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <executorch/examples/models/llama/runner/runner.h>
1717
#include <executorch/examples/models/llava/runner/llava_runner.h>
18+
#include <executorch/examples/qualcomm/oss_scripts/llama/runner/runner.h>
1819
#include <executorch/extension/llm/runner/image.h>
1920
#include <executorch/extension/llm/runner/irunner.h>
2021
#include <executorch/runtime/platform/log.h>
@@ -181,10 +182,10 @@ class ExecuTorchLlmJni : public facebook::jni::HybridClass<ExecuTorchLlmJni> {
181182
data_path_str);
182183
#if defined(EXECUTORCH_BUILD_QNN)
183184
} else if (model_type_category == MODEL_TYPE_QNN_LLAMA) {
184-
std::unique_ptr<executorch::extension::Module> module =
185-
std::make_unique<executorch::extension::Module>(
186-
FLAGS_model_path.c_str(),
187-
executorch::extension::Module::LoadMode::MmapUseMlockIgnoreErrors);
185+
std::unique_ptr<executorch::extension::Module> module = std::make_unique<
186+
executorch::extension::Module>(
187+
model_path->toStdString().c_str(),
188+
executorch::extension::Module::LoadMode::MmapUseMlockIgnoreErrors);
188189
std::string decoder_model = "llama3"; // use llama3 for now
189190
runner_ = std::make_unique<example::Runner<uint16_t>>( // QNN runner
190191
std::move(module),

0 commit comments

Comments
 (0)