Skip to content

Commit

Permalink
address partial eq for sequence data
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeantonio21 committed Sep 25, 2024
1 parent 7dfc696 commit f361fc1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backends/vllm/src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ pub struct RequestMetrics {
///
/// This struct holds information about the prompt and generated output tokens,
/// as well as metadata about the sequence's processing state.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug)]
pub struct SequenceData {
/// The token IDs of the initial prompt
prompt_token_ids: Vec<u32>,
Expand All @@ -174,6 +174,16 @@ pub struct SequenceData {
span: Span,
}

impl PartialEq for SequenceData {
fn eq(&self, other: &Self) -> bool {
self.prompt_token_ids == other.prompt_token_ids
&& self.output_token_ids == other.output_token_ids
&& self.cumulative_logprob == other.cumulative_logprob
&& self.num_computed_tokens == other.num_computed_tokens
&& self.stage == other.stage
}
}

impl SequenceData {
/// Constructor
pub fn new(prompt_token_ids: Vec<u32>, output_token_ids: Vec<u32>) -> Self {
Expand Down

0 comments on commit f361fc1

Please sign in to comment.