Spaces:
Sleeping

sosppxo commited on
Commit
6e1cd32
·
verified ·
1 Parent(s): b0d7d63

Align SAM2 high-resolution input precision

Browse files
Files changed (1) hide show
  1. model/LISA_sam2.py +2 -2
model/LISA_sam2.py CHANGED
@@ -427,7 +427,7 @@ class LISAForCausalLM(LlavaLlamaForCausalLM):
427
  #get high res feat
428
 
429
  img_batch = self.model._transforms.forward_batch(read_images(kwargs["image_paths"]))
430
- img_batch = img_batch.to(self.device)
431
 
432
  assert (
433
  len(img_batch.shape) == 4 and img_batch.shape[1] == 3
@@ -697,7 +697,7 @@ class LISAForCausalLM(LlavaLlamaForCausalLM):
697
  image_embeddings = self.get_visual_embs(images)
698
  #get high res feat
699
  img_batch = self.model._transforms.forward_batch(read_images(image_paths))
700
- img_batch = img_batch.to(self.device)
701
  batch_size = image_embeddings.shape[0]
702
  assert (
703
  len(img_batch.shape) == 4 and img_batch.shape[1] == 3
 
427
  #get high res feat
428
 
429
  img_batch = self.model._transforms.forward_batch(read_images(kwargs["image_paths"]))
430
+ img_batch = img_batch.to(device=self.device, dtype=images.dtype)
431
 
432
  assert (
433
  len(img_batch.shape) == 4 and img_batch.shape[1] == 3
 
697
  image_embeddings = self.get_visual_embs(images)
698
  #get high res feat
699
  img_batch = self.model._transforms.forward_batch(read_images(image_paths))
700
+ img_batch = img_batch.to(device=self.device, dtype=images.dtype)
701
  batch_size = image_embeddings.shape[0]
702
  assert (
703
  len(img_batch.shape) == 4 and img_batch.shape[1] == 3