Skip to content

Commit cbe4ba6

Browse files
lucylqfacebook-github-bot
authored andcommitted
Use tokenizer eos
Summary: Currently we check the tokenizer eos, and then override it with method eos. Sounds like this was for legacy cases where tokenizer did not store eos. Use tokenizer eos as source of truth. Differential Revision: D84865804
1 parent caa35f6 commit cbe4ba6

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

extension/llm/runner/llm_runner_helper.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,27 +154,6 @@ std::unordered_set<uint64_t> get_eos_ids(
154154
tokenizers::Tokenizer* tokenizer,
155155
Module* module) {
156156
std::unordered_set<uint64_t> eos_ids = {tokenizer->eos_tok()};
157-
// Get EOS IDs if available
158-
auto method_names_result = module->method_names();
159-
if (method_names_result.error() != Error::Ok) {
160-
ET_LOG(Error, "Failed reading method names");
161-
return eos_ids;
162-
}
163-
const auto& method_names = method_names_result.get();
164-
165-
if (method_names.count(llm::kEosIds)) {
166-
eos_ids.clear();
167-
auto execute_result = module->execute(llm::kEosIds);
168-
if (execute_result.error() != Error::Ok) {
169-
ET_LOG(Error, "Failed to execute %s", llm::kEosIds);
170-
return eos_ids;
171-
}
172-
for (const auto& eos_id : execute_result.get()) {
173-
auto value = eos_id.toScalar().to<int64_t>();
174-
eos_ids.emplace(value);
175-
ET_LOG(Info, "eos_id = %" PRId64, value);
176-
}
177-
}
178157
return eos_ids;
179158
}
180159

0 commit comments

Comments
 (0)