From cbb8a37929c3860210f95c9ec99b8b84b8cf57a1 Mon Sep 17 00:00:00 2001 From: Yih-Dar <2521628+ydshieh@users.noreply.github.com> Date: Mon, 10 Oct 2022 09:05:30 +0100 Subject: [PATCH] Skip `BloomEmbeddingTest.test_embeddings` for PyTorch < 1.10 (#19261) Co-authored-by: ydshieh --- tests/models/bloom/test_modeling_bloom.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/models/bloom/test_modeling_bloom.py b/tests/models/bloom/test_modeling_bloom.py index 06cec20456..9858a390fa 100644 --- a/tests/models/bloom/test_modeling_bloom.py +++ b/tests/models/bloom/test_modeling_bloom.py @@ -37,6 +37,7 @@ if is_torch_available(): BloomModel, BloomTokenizerFast, ) + from transformers.pytorch_utils import is_torch_greater_or_equal_than_1_10 @require_torch @@ -500,9 +501,14 @@ class BloomEmbeddingTest(unittest.TestCase): super().setUp() self.path_bigscience_model = "bigscience/bigscience-small-testing" + @unittest.skipIf( + not is_torch_available() or not is_torch_greater_or_equal_than_1_10, + "Test failed with torch < 1.10 (`LayerNormKernelImpl` not implemented for `BFloat16`)", + ) @require_torch def test_embeddings(self): - model = BloomForCausalLM.from_pretrained(self.path_bigscience_model, torch_dtype="auto") # load in fp32 + # The config in this checkpoint has `bfloat16` as `torch_dtype` -> model in `bfloat16` + model = BloomForCausalLM.from_pretrained(self.path_bigscience_model, torch_dtype="auto") model.eval() EMBEDDINGS_DS_BEFORE_LN_BF_16_MEAN = {