Skip to content

Commit

Permalink
remove additional timers
Browse files Browse the repository at this point in the history
  • Loading branch information
mzegla committed Jul 24, 2024
1 parent 468cc37 commit 949a4fc
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions src/cpp/src/sampler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "logit_processor.hpp"
#include "scheduler.hpp"
#include "sequence_group.hpp"
#include "timer.hpp"

namespace ov::genai {
// Modifyed Knuth–Morris–Pratt algorithm which returns tokens following after every needle occurance in haystack
Expand Down Expand Up @@ -304,29 +303,16 @@ SamplerOutput Sampler::sample(std::vector<SequenceGroup::Ptr> & sequence_groups,
running_sequence->append_token(sampled_token_id.m_index, sampled_token_id.m_log_prob);
};
for (size_t running_sequence_id = 0; running_sequence_id < num_running_sequences; ++running_sequence_id) {
static ManualTimer timer1("sample::_get_logit_vector");
timer1.start();
auto logit_vector = _get_logit_vector(sequence_group_logits, running_sequence_id);
timer1.end();
static ManualTimer timer2("sample::logit_processor.apply");
timer2.start();
logit_processor.apply(logit_vector);
timer2.end();

Token sampled_token_id;
if (sampling_params.is_greedy_decoding()) {
static ManualTimer timer("sample::_greedy_sample");
timer.start();
sampled_token_id = _greedy_sample(logit_vector);
timer.end();
} else {
// is_multinomial()
const bool is_generate_n_tokens = sequence_group->num_total_seqs() == 1;
const size_t num_tokens_per_sequence = is_generate_n_tokens ? sampling_params.num_return_sequences : 1;
static ManualTimer timer("sample::_multinomial_sample");
timer.start();
auto sampled_token_ids = _multinomial_sample(logit_vector, num_tokens_per_sequence);
timer.end();
sampled_token_id = sampled_token_ids[0];

if (is_generate_n_tokens) {
Expand Down

0 comments on commit 949a4fc

Please sign in to comment.