lutzroeder commited on
Commit
a0e3087
1 Parent(s): b161793

Fix h_crop and w_crop device

Browse files

Fix `Placeholder storage has not been allocated on MPS device!` when running with `torch==2.4.0` and `device=mps`.

Files changed (1) hide show
  1. image_embedding_phi3_v.py +1 -1
image_embedding_phi3_v.py CHANGED
@@ -269,7 +269,7 @@ class Phi3ImageEmbedding(nn.Module):
269
  """
270
  N, L, C = image_features.shape
271
  assert L == 24 * 24 and C == 1024 and N % (h_crop * w_crop) == 0
272
- num_images = N // (h_crop * w_crop)
273
  H = int(L**0.5)
274
  image_features_hd = (
275
  image_features.reshape(N, H, H, C) # N, 24, 24, 1024
 
269
  """
270
  N, L, C = image_features.shape
271
  assert L == 24 * 24 and C == 1024 and N % (h_crop * w_crop) == 0
272
+ num_images = N // (int(h_crop) * int(w_crop))
273
  H = int(L**0.5)
274
  image_features_hd = (
275
  image_features.reshape(N, H, H, C) # N, 24, 24, 1024