Skip to content

Commit

Permalink
Update tests/models/grounding_dino/test_modeling_grounding_dino.py
Browse files Browse the repository at this point in the history
Co-authored-by: Sangbum Daniel Choi <34004152+SangbumChoi@users.noreply.github.com>
  • Loading branch information
EduardoPach and SangbumChoi committed Aug 27, 2024
1 parent 4ed4881 commit 4788402
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/models/grounding_dino/test_modeling_grounding_dino.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ def prepare_config_and_inputs(self):
pixel_values = floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])
pixel_mask = torch.ones([self.batch_size, self.image_size, self.image_size], device=torch_device)

# To avoid erros when running tests with `labels` `input_ids` have to follow this structure
input_ids = torch.tensor([101, 3869, 1012, 11420, 1012, 1012, 102])
# To avoid errors when running tests with `labels` `input_ids` have to follow this structure.
# Start with 101 which means [CLS], 102 means [SEP], and 1012 means dot symbol for the divider. (e.g. '[CLS] fish. shark. [SEP]')
input_ids = torch.tensor([101, 3869, 1012, 11420, 1012, 102])
input_ids = input_ids.unsqueeze(0).expand(self.batch_size, -1)

labels = None
Expand Down

0 comments on commit 4788402

Please sign in to comment.