-
Notifications
You must be signed in to change notification settings - Fork 724
Qualcomm AI Engine Direct - Optimize QNN embedding op for llama #6725
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
Changes from 1 commit
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 |
|---|---|---|
|
|
@@ -23,12 +23,14 @@ class ET_EXPERIMENTAL TextTokenGenerator { | |
| TextTokenGenerator( | ||
| Tokenizer* tokenizer, | ||
| TextDecoderRunner* text_decoder_runner, | ||
| bool use_int32_token, | ||
|
||
| bool use_kv_cache, | ||
| std::unique_ptr<std::unordered_set<uint64_t>>&& eos_ids, | ||
| Stats* stats) | ||
| : tokenizer_(tokenizer), | ||
| text_decoder_runner_(text_decoder_runner), | ||
| eos_ids_(std::move(eos_ids)), | ||
| use_int32_token_(use_int32_token), | ||
| use_kv_cache_(use_kv_cache), | ||
| stats_(stats) {} | ||
|
|
||
|
|
@@ -54,6 +56,9 @@ class ET_EXPERIMENTAL TextTokenGenerator { | |
|
|
||
| std::vector<uint64_t> token_data; // allocate space for the tokens | ||
| std::vector<executorch::aten::SizesType> token_shape; | ||
| exec_aten::ScalarType token_type = use_int32_token_ | ||
| ? exec_aten::ScalarType::Int | ||
| : exec_aten::ScalarType::Long; | ||
|
|
||
| // Token after prefill | ||
| uint64_t cur_token = tokens.back(); | ||
|
|
@@ -70,8 +75,7 @@ class ET_EXPERIMENTAL TextTokenGenerator { | |
| } | ||
|
|
||
| // initialize tensor wrappers | ||
| auto tokens_managed = from_blob( | ||
| token_data.data(), token_shape, executorch::aten::ScalarType::Long); | ||
| auto tokens_managed = from_blob(token_data.data(), token_shape, token_type); | ||
| auto start_pos_managed = | ||
| from_blob(&pos, {1}, executorch::aten::ScalarType::Long); | ||
|
|
||
|
|
@@ -133,6 +137,7 @@ class ET_EXPERIMENTAL TextTokenGenerator { | |
| Tokenizer* tokenizer_; | ||
| TextDecoderRunner* text_decoder_runner_; | ||
| std::unique_ptr<std::unordered_set<uint64_t>> eos_ids_; | ||
| bool use_int32_token_; | ||
| bool use_kv_cache_; | ||
|
|
||
| // state machine | ||
|
|
||
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.
oh I meant more like
so we don't need to update all callsite...
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.
Sorry about misunderstanding. I have updated. Thanks!