Skip to content

Commit

Permalink
drop GIL for mid_process()
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Jul 31, 2024
1 parent 20e7fae commit 5e66bc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rust/src/py.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ impl LLInterpreter {
self.inner.process_prompt(prompt)
}

fn mid_process(&mut self) -> (Option<Cow<[u8]>>, String) {
fn mid_process(&mut self, py: Python<'_>) -> (Option<Cow<[u8]>>, String) {
let arg = std::mem::replace(&mut self.step_arg, StepArg::empty());
self.last_result = self.inner.mid_process(arg);
self.last_result = py.allow_threads(|| self.inner.mid_process(arg));
let r = &self.last_result;
let is_final = r.is_stop();
if let Some(t) = r.temperature {
Expand Down

0 comments on commit 5e66bc7

Please sign in to comment.