-
Notifications
You must be signed in to change notification settings - Fork 725
[Executorch][LLM] Use caching allocator for runner #15730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: gh/kimishpatel/213/base
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
| #include <executorch/extension/llm/runner/text_llm_runner.h> | ||
| #include <executorch/extension/llm/runner/text_prefiller.h> | ||
| #include <executorch/extension/llm/runner/text_token_generator.h> | ||
| #include <executorch/extension/memory_allocator/cpu_caching_malloc_allocator.h> | ||
| #include <executorch/runtime/core/result.h> | ||
| #include <executorch/runtime/platform/runtime.h> | ||
| #include <pytorch/tokenizers/hf_tokenizer.h> | ||
|
|
@@ -209,11 +210,26 @@ std::unique_ptr<TextLLMRunner> create_text_llm_runner( | |
|
|
||
| // Create the Module | ||
| std::unique_ptr<Module> module; | ||
| uint32_t max_cached_memory_size_bytes_ = 1024 * 1024 * 10; // 10MB | ||
|
||
| if (data_files.size() > 0) { | ||
| module = std::make_unique<Module>( | ||
| model_path, data_files, Module::LoadMode::File); | ||
| model_path, | ||
| data_files, | ||
| Module::LoadMode::File, | ||
| nullptr, | ||
| std::make_unique< | ||
| executorch::extension::CPUCachingAllocator>( // temp memory | ||
| // allocator | ||
| max_cached_memory_size_bytes_)); | ||
| } else { | ||
| module = std::make_unique<Module>(model_path, Module::LoadMode::File); | ||
| module = std::make_unique<Module>( | ||
| model_path, | ||
| Module::LoadMode::File, | ||
| nullptr, | ||
| std::make_unique< | ||
| executorch::extension::CPUCachingAllocator>( // temp memory | ||
| // allocator | ||
| max_cached_memory_size_bytes_)); | ||
| } | ||
|
|
||
| // Get metadata from Module | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path
extension/memory_allocator/runnerdoes not exist in the repository. The memory allocator CMakeLists.txt is located atextension/memory_allocator/CMakeLists.txt. This line should be: