Skip to content

fix: replace hardcoded .cuda() with dynamic device inference#1921

Open
Mr-Neutr0n wants to merge 1 commit intohaotian-liu:mainfrom
Mr-Neutr0n:fix/hardcoded-cuda-device
Open

fix: replace hardcoded .cuda() with dynamic device inference#1921
Mr-Neutr0n wants to merge 1 commit intohaotian-liu:mainfrom
Mr-Neutr0n:fix/hardcoded-cuda-device

Conversation

@Mr-Neutr0n
Copy link
Copy Markdown

Bug

In llava/eval/run_llava.py, input_ids is placed on device via a hardcoded .cuda() call (line 111). This breaks inference on non-CUDA devices (MPS, CPU) and can cause device mismatch errors in multi-GPU setups.

Notably, images_tensor on the preceding line already correctly uses .to(model.device, ...), making the hardcoded .cuda() on input_ids inconsistent.

Fix

Replaced .cuda() with .to(model.device) so input_ids is placed on the same device as the model, matching the pattern already used for images_tensor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant