From a19a059d4005e125ae69a79d7558b2035d4e53bc Mon Sep 17 00:00:00 2001 From: Dave Bort Date: Fri, 20 Sep 2024 12:01:14 -0700 Subject: [PATCH] Fix phi-3-mini build (#5513) Summary: Fix the build errors I introduced in https://github.com/pytorch/executorch/pull/5318 Pull Request resolved: https://github.com/pytorch/executorch/pull/5513 Test Plan: Built the model using the instructions at https://github.com/pytorch/executorch/blob/main/examples/models/phi-3-mini/README.md Reviewed By: helunwencser Differential Revision: D63133231 Pulled By: dbort fbshipit-source-id: 81d5402e76fd86c919a13a1b1b83687feca72ab7 (cherry picked from commit 8618607e1388358591366db579040e7d18a7ea6a) --- examples/models/phi-3-mini/main.cpp | 2 +- examples/models/phi-3-mini/runner.cpp | 6 ++++++ examples/models/phi-3-mini/runner.h | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/models/phi-3-mini/main.cpp b/examples/models/phi-3-mini/main.cpp index 7aedcb75b28..86446a8bde3 100644 --- a/examples/models/phi-3-mini/main.cpp +++ b/examples/models/phi-3-mini/main.cpp @@ -42,7 +42,7 @@ int main(int32_t argc, char** argv) { int32_t seq_len = FLAGS_seq_len; - ::torch::executor::Runner runner(model_path, tokenizer_path, temperature); + example::Runner runner(model_path, tokenizer_path, temperature); runner.generate(prompt, seq_len); diff --git a/examples/models/phi-3-mini/runner.cpp b/examples/models/phi-3-mini/runner.cpp index 8328755c423..4af100ba270 100644 --- a/examples/models/phi-3-mini/runner.cpp +++ b/examples/models/phi-3-mini/runner.cpp @@ -15,6 +15,12 @@ #include #include +using executorch::aten::ScalarType; +using executorch::extension::Module; +using executorch::extension::llm::BPETokenizer; +using executorch::extension::llm::Sampler; +using executorch::runtime::Error; + namespace example { #define SAMPLER_TOP 0.9f diff --git a/examples/models/phi-3-mini/runner.h b/examples/models/phi-3-mini/runner.h index f12fcbf1693..9b24f971708 100644 --- a/examples/models/phi-3-mini/runner.h +++ b/examples/models/phi-3-mini/runner.h @@ -42,9 +42,9 @@ class Runner { uint64_t prefill(std::vector& tokens); uint64_t run_model_step(uint64_t token); - std::unique_ptr module_; - std::unique_ptr tokenizer_; - std::unique_ptr sampler_; + std::unique_ptr module_; + std::unique_ptr tokenizer_; + std::unique_ptr sampler_; }; } // namespace example