Skip to content

Commit

Permalink
fix: move string
Browse files Browse the repository at this point in the history
  • Loading branch information
sangjanai committed Jun 14, 2024
1 parent 5eee001 commit e372252
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/onnx_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,12 @@ void OnnxEngine::HandleChatCompletion(
formatted_output += ai_prompt_;

// LOG_DEBUG << formatted_output;
// TODO(sang)
q_->runTaskInQueue([this, cb = std::move(callback), formatted_output, req] {
q_->runTaskInQueue([this, cb = std::move(callback),
fo = std::move(formatted_output), req] {
try {
if (req.stream) {

auto sequences = OgaSequences::Create();
tokenizer_->Encode(formatted_output.c_str(), *sequences);
tokenizer_->Encode(fo.c_str(), *sequences);

auto params = OgaGeneratorParams::Create(*oga_model_);
// TODO(sang)
Expand Down Expand Up @@ -273,7 +272,7 @@ void OnnxEngine::HandleChatCompletion(

} else {
auto sequences = OgaSequences::Create();
tokenizer_->Encode(formatted_output.c_str(), *sequences);
tokenizer_->Encode(fo.c_str(), *sequences);

auto params = OgaGeneratorParams::Create(*oga_model_);
params->SetSearchOption("max_length", req.max_tokens);
Expand Down

0 comments on commit e372252

Please sign in to comment.