Skip to content

Commit 340bf41

Browse files
hjh0119Jintao-Huang
authored andcommitted
[bugfix] fix vllm sleep&wake_up produces meaningless output (#5143)
* fix vllm meaningless output * add comments
1 parent 9b05413 commit 340bf41

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

swift/trainers/rlhf_trainer/grpo_trainer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,9 @@ def _fast_infer(self, inputs: InputsType) -> Tuple[InputsType, OutputsType]:
842842
outputs = self._infer_single_or_multi_turn(inputs, self.request_config)
843843

844844
if self.vllm_mode == 'colocate' and self.args.sleep_level > 0:
845+
# Reset prefix cache before sleeping to prevent using stale cache upon waking up
846+
# https://github.com/modelscope/ms-swift/pull/5143
847+
self.engine.engine.reset_prefix_cache()
845848
self.engine.engine.sleep(level=self.args.sleep_level)
846849
empty_cache()
847850

0 commit comments

Comments
 (0)