-
Notifications
You must be signed in to change notification settings - Fork 749
[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 9 commits
00fffa1
5cecbfc
e09bcd6
356ec2f
1f59722
2aaf193
e91d367
7784291
10c67dc
a7be4da
cc6beb5
9b35c78
4db1a94
ea7c837
b340181
af57723
e4845c5
1d85984
559d0d3
5198114
c2bbfbd
90d3d57
be88d80
4082b28
54f9381
494bbd5
4092750
4e0b339
d63ffbd
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: