Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/models/bloom/test_modeling_bloom.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def test_batch_generation(self):

input_sentence = ["I enjoy walking with my cute dog", "I enjoy walking with my cute dog"]

inputs = tokenizer.batch_encode_plus(input_sentence, return_tensors="pt", padding=True)
inputs = tokenizer(input_sentence, return_tensors="pt", padding=True)
input_ids = inputs["input_ids"].to(torch_device)
attention_mask = inputs["attention_mask"]
greedy_output = model.generate(input_ids, attention_mask=attention_mask, max_length=50, do_sample=False)
Expand All @@ -565,7 +565,7 @@ def test_batch_generation_padding(self):
input_sentence = ["I enjoy walking with my cute dog", "Hello my name is"]
input_sentence_without_pad = "Hello my name is"

input_ids = tokenizer.batch_encode_plus(input_sentence, return_tensors="pt", padding=True)
input_ids = tokenizer(input_sentence, return_tensors="pt", padding=True)
input_ids_without_pad = tokenizer.encode(input_sentence_without_pad, return_tensors="pt")

input_ids, attention_mask = input_ids["input_ids"].to(torch_device), input_ids["attention_mask"]
Expand Down
16 changes: 12 additions & 4 deletions tests/models/clap/test_modeling_clap.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,9 @@ def test_integration_unfused(self):
expected_mean = EXPECTED_MEANS_UNFUSED[padding]

self.assertTrue(
torch.allclose(audio_embed.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3)
torch.allclose(
audio_embed.pooler_output.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3
)
)

def test_integration_fused(self):
Expand All @@ -565,7 +567,9 @@ def test_integration_fused(self):
expected_mean = EXPECTED_MEANS_FUSED[padding]

self.assertTrue(
torch.allclose(audio_embed.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3)
torch.allclose(
audio_embed.pooler_output.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3
)
)

def test_batched_fused(self):
Expand All @@ -592,7 +596,9 @@ def test_batched_fused(self):
expected_mean = EXPECTED_MEANS_FUSED[padding]

self.assertTrue(
torch.allclose(audio_embed.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3)
torch.allclose(
audio_embed.pooler_output.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3
)
)

def test_batched_unfused(self):
Expand All @@ -617,5 +623,7 @@ def test_batched_unfused(self):
expected_mean = EXPECTED_MEANS_FUSED[padding]

self.assertTrue(
torch.allclose(audio_embed.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3)
torch.allclose(
audio_embed.pooler_output.cpu().mean(), torch.tensor([expected_mean]), atol=1e-3, rtol=1e-3
)
)
1 change: 1 addition & 0 deletions tests/models/clvp/test_modeling_clvp.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class ClvpModelForConditionalGenerationTester:
def __init__(self, parent, is_training=False):
self.parent = parent
self.clvp_encoder_tester = ClvpEncoderTester(parent)
self.text_model_tester = self.clvp_encoder_tester
self.is_training = is_training
self.batch_size = self.clvp_encoder_tester.batch_size # need bs for batching_equivalence test

Expand Down