mirror of
https://github.com/openai/CLIP.git
synced 2026-11-05 01:37:26 +00:00
[GH-ISSUE #247] forward pass on torch.device("mps") #214
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openai/CLIP#214
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dribnet on GitHub (May 24, 2022).
Original GitHub issue: https://github.com/openai/CLIP/issues/247
Would be great to get this running on pytorch M1. Has anyone managed to get a forward pass on
torch.device("mps")? Just posting this issue here in case others want to compare notes on this.I gave it a shot but so far I haven't been able to get a forward pass through CLIP to work for images or text when tensors and model are on the mps device. Here's my stacktrace.
As suggested for this error online, I tried calling
.contiguous().reshapeon the tensor before passing it tomodel.encode_image/model.encode_textbut this didn't seem to help. My guess is that the memory layout on the tensor is somehow different that expected deep within that call but not sure if there is a workaround.@lowfuel commented on GitHub (Jun 13, 2022):
I haven't seen that. I get this error on even the most basic implementation:
RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)