Unverified Commit 5a551df9 authored by Yih-Dar's avatar Yih-Dar Committed by GitHub
Browse files

Fix `TvpModelIntegrationTests` (#27792)



* fix

* fix

* fix

---------
Co-authored-by: default avatarydshieh <ydshieh@users.noreply.github.com>
parent c0b9db09
...@@ -230,10 +230,11 @@ class TvpModelIntegrationTests(unittest.TestCase): ...@@ -230,10 +230,11 @@ class TvpModelIntegrationTests(unittest.TestCase):
image_processor = self.default_image_processor image_processor = self.default_image_processor
image = prepare_img() image = prepare_img()
encoding = image_processor(images=image, return_tensors="pt").to(torch_device) encoding = image_processor(images=image, return_tensors="pt")
input_ids = torch.tensor([[1, 2]]) input_ids = torch.tensor([[1, 2]])
attention_mask = torch.tensor([[1, 1]]) attention_mask = torch.tensor([[1, 1]])
encoding.update({"input_ids": input_ids, "attention_mask": attention_mask}) encoding.update({"input_ids": input_ids, "attention_mask": attention_mask})
encoding.to(torch_device)
with torch.no_grad(): with torch.no_grad():
outputs = model(**encoding) outputs = model(**encoding)
...@@ -250,10 +251,11 @@ class TvpModelIntegrationTests(unittest.TestCase): ...@@ -250,10 +251,11 @@ class TvpModelIntegrationTests(unittest.TestCase):
image_processor = self.default_image_processor image_processor = self.default_image_processor
image = prepare_img() image = prepare_img()
encoding = image_processor(images=image, return_tensors="pt").to(torch_device) encoding = image_processor(images=image, return_tensors="pt")
input_ids = torch.tensor([[1, 2]]) input_ids = torch.tensor([[1, 2]])
attention_mask = torch.tensor([[1, 1]]) attention_mask = torch.tensor([[1, 1]])
encoding.update({"input_ids": input_ids, "attention_mask": attention_mask}) encoding.update({"input_ids": input_ids, "attention_mask": attention_mask})
encoding.to(torch_device)
with torch.no_grad(): with torch.no_grad():
outputs = model(**encoding) outputs = model(**encoding)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment