Fix building alibi tensor when num_heads is not a power of 2 (#28380)

* Fix building alibi tensor when num_heads is not a power of 2

* Remove print function
This commit is contained in:
Mohamed Abu El-Nasr
2024-01-08 11:39:40 +02:00
committed by GitHub
parent 53cffeb33c
commit 0c2121f99b
2 changed files with 9 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ class MptModelTester:
use_labels=True,
use_mc_token_ids=True,
vocab_size=99,
hidden_size=32,
hidden_size=48,
num_hidden_layers=2,
num_attention_heads=4,
intermediate_size=37,
@@ -385,6 +385,12 @@ class MptModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMixin,
config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_mpt_model(*config_and_inputs)
def test_mpt_model_alibi_tensor(self):
# test creation of alibi tensor when num heads is not a power of two
config_and_inputs = self.model_tester.prepare_config_and_inputs()
config_and_inputs[0].n_heads = 6
self.model_tester.create_and_check_mpt_model(*config_and_inputs)
def test_mpt_model_past(self):
config_and_inputs = self.model_tester.prepare_config_and_inputs()
self.model_tester.create_and_check_mpt_model_past(*config_and_inputs)