Skip to content
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

Move set_input_tensor() outside #1

Draft
wants to merge 1 commit into
base: replace-compex-loops-with-index-access-reuse-pack_strings-and-unpack_strings
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llm/cpp/llm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ int main(int argc, char* argv[]) try {
ireq.get_tensor("attention_mask").set_shape({BATCH_SIZE, 1});
ireq.get_tensor("attention_mask").data<int32_t>()[0] = 1;
constexpr int32_t SPECIAL_EOS_TOKEN = 2; // There's no way to extract the value from the tokenizer for now
for (size_t idx = 2; idx < inputs.size(); ++idx) {
ireq.set_input_tensor(idx, ireq.get_output_tensor(idx - 1));
}
while (out_token != SPECIAL_EOS_TOKEN) {
for (size_t idx = 2; idx < inputs.size(); ++idx) {
ireq.set_input_tensor(idx, ireq.get_output_tensor(idx - 1));
}
ireq.get_tensor("input_ids").data<int32_t>()[0] = out_token;
ireq.start_async();
print_token(detokenizer, out_token);
Expand Down