Skip to content

fix: convert slot_mapping tensor to array in tpu_model_runner #17970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

juncgu
Copy link

@juncgu juncgu commented May 11, 2025

fix: convert slot_mapping tensor to ndarray in tpu_model_runner

The slot_mapping tensor of the scheduled_tokens should be converted to an array. The issue was caused by #17483.

FIX #17969

Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

@mergify mergify bot added v1 tpu Related to Google TPUs labels May 11, 2025
Copy link
Collaborator

@heheda12345 heheda12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. We have the numpy format tensor in block table. You can just use it.

@@ -531,7 +531,7 @@ def _prepare_inputs(self, scheduler_output: "SchedulerOutput"):
np.add(block_numbers * self.block_size,
block_offsets,
out=self.input_batch.block_table.
slot_mapping_cpu[:total_num_scheduled_tokens])
slot_mapping_cpu[:total_num_scheduled_tokens].numpy())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
slot_mapping_cpu[:total_num_scheduled_tokens].numpy())
slot_mapping_np[:total_num_scheduled_tokens]

@heheda12345
Copy link
Collaborator

Close as duplicate with #17971. But still thanks very much for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tpu Related to Google TPUs v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: slot_mapping of schedulined_tokens in tpu_model_runner should be an array (not tensor).
2 participants