Skip to content

Commit

Permalink
Clean up logits in phi3 C++ example (#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
daijh authored Dec 13, 2024
1 parent 51829fb commit 7735e10
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions examples/c/src/phi3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,6 @@ void CXX_API(const char* model_path) {
is_first_token = false;
}

// Show usage of GetOutput
std::unique_ptr<OgaTensor> output_logits = generator->GetOutput("logits");

// Assuming output_logits.Type() is float as it's logits
// Assuming shape is 1 dimensional with shape[0] being the size
auto logits = reinterpret_cast<float*>(output_logits->Data());

// Print out the logits using the following snippet, if needed
//auto shape = output_logits->Shape();
//for (size_t i=0; i < shape[0]; i++)
// std::cout << logits[i] << " ";
//std::cout << std::endl;

const auto num_tokens = generator->GetSequenceCount(0);
const auto new_token = generator->GetSequenceData(0)[num_tokens - 1];
std::cout << tokenizer_stream->Decode(new_token) << std::flush;
Expand Down

0 comments on commit 7735e10

Please sign in to comment.