From b8422d1ba48916c6ea024f9c23cd3baf9d66130f Mon Sep 17 00:00:00 2001 From: Geaming <71267655+Geaming2002@users.noreply.github.com> Date: Thu, 22 May 2025 16:47:55 +0800 Subject: [PATCH] Add explicit position_ids to model.generate in hf rollout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added position_ids parameter to the model.generate method call to provide explicit control over token positions during text generation. I don't quite understand why have obtained position ids above but not passed them to generate, so I modified this.😂 --- verl/workers/rollout/hf_rollout.py | 1 + 1 file changed, 1 insertion(+) diff --git a/verl/workers/rollout/hf_rollout.py b/verl/workers/rollout/hf_rollout.py index 7b04e51ef66..f91ade28a73 100644 --- a/verl/workers/rollout/hf_rollout.py +++ b/verl/workers/rollout/hf_rollout.py @@ -109,6 +109,7 @@ def _generate_minibatch(self, prompts: DataProto) -> DataProto: output = self.module.generate( input_ids=idx, attention_mask=attention_mask, + position_ids=position_ids, do_sample=do_sample, max_new_tokens=response_length, eos_token_id=eos_token_id,