Skip to content

Commit

Permalink
temperature setting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed May 9, 2024
1 parent fd8c5ee commit 5291046
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rllm/rllm-base/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ impl<ME: ModelExec> RllmEngine<ME> {
let seq_idx = b.sample_mask.unwrap();
aici_bias.apply(&mut logits, seq_idx);
if let Some(t) = b.temperature {
sg.logits_processor.temperature = Some(t);
sg.logits_processor.set_temperature(t);
}
}
None => {}
Expand Down
8 changes: 8 additions & 0 deletions rllm/rllm-base/src/logits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ impl LogitsProcessor {
top_p: sampling_params.top_p,
}
}

pub fn set_temperature(&mut self, temperature: f32) {
if temperature < SAMPLING_EPS {
self.temperature = None;
} else {
self.temperature = Some(temperature);
}
}
}

0 comments on commit 5291046

Please sign in to comment.