[Bugfix][MM] Move grid_thw tensor to cpu before directly converting to numpy#29770
[Bugfix][MM] Move grid_thw tensor to cpu before directly converting to numpy#29770shen-shanshan wants to merge 1 commit intovllm-project:mainfrom
grid_thw tensor to cpu before directly converting to numpy#29770Conversation
Signed-off-by: shen-shanshan <467638484@qq.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
grid_thw tensor to cpu before directly converting to numpy
There was a problem hiding this comment.
Code Review
This pull request correctly fixes a TypeError that occurs when converting a tensor to a NumPy array on a non-CPU device. The change introduces a .to("cpu") call to move the grid_thw tensor to the CPU before the conversion, which is the proper way to handle this. The fix is targeted and effective. I have no further comments.
|
I'm a bit confused where this error is coming from. Shouldn't #28168 prevent |
After discussing with @DarkLight1337 , this error is because the |
Pull request was closed
Purpose
When
grid_thwin ViT forward is a tensor, it should be moved to cpu before directly converting to numpy, otherwise there could be error like:TypeError: can't convert npu:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.