diff --git a/vllm/v1/worker/gpu_model_runner.py b/vllm/v1/worker/gpu_model_runner.py index c943f02212..cedf95e319 100644 --- a/vllm/v1/worker/gpu_model_runner.py +++ b/vllm/v1/worker/gpu_model_runner.py @@ -6164,6 +6164,11 @@ class GPUModelRunner( num_tokens_padded, None, False ) + num_tokens_unpadded = num_tokens_padded if is_profile else 0 + is_padding = self._prepare_padding_mask( + num_tokens_unpadded, num_tokens_padded + ) + if ubatch_slices_padded is not None: # Adjust values to reflect a single ubatch. # TODO(sage,lucas): this is cruft that should be addressed in @@ -6172,8 +6177,6 @@ class GPUModelRunner( if num_tokens_across_dp is not None: num_tokens_across_dp[:] = num_tokens_padded - is_padding = self._prepare_padding_mask(0, num_tokens_padded) - with ( self.maybe_randomize_inputs( input_ids, inputs_embeds, randomize_inputs=randomize_inputs