Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: jiqing-feng <[email protected]>
  • Loading branch information
jiqing-feng committed Dec 16, 2024
1 parent 7dc08da commit 30027ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test_ipex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:
python -c "import intel_extension_for_pytorch; print(intel_extension_for_pytorch.__version__); assert intel_extension_for_pytorch.__version__.startswith('${{ matrix.torch-version }}'.replace('.*', ''))"
python -c "import transformers; print(transformers.__version__); assert transformers.__version__.startswith('${{ matrix.transformers-version }}'.replace('.*', ''))"
- name: Test with Pytest
run: |
pytest tests/ipex
- if: ${{ matrix.torch-version != '2.4.0' }}
name: Install bitsandbytes
run: |
pip install https://github.com/bitsandbytes-foundation/bitsandbytes/releases/download/continuous-release_multi-backend-refactor/bitsandbytes-0.45.0.dev0-py3-none-manylinux_2_24_x86_64.whl
- name: Test with Pytest
run: |
pytest tests/ipex
10 changes: 5 additions & 5 deletions tests/ipex/test_modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
PretrainedConfig,
pipeline,
set_seed,
is_bitsandbytes_available,
)
from transformers.testing_utils import is_bitsandbytes_available, require_bitsandbytes
from optimum.intel import (
IPEXModel,
IPEXModelForAudioClassification,
Expand Down Expand Up @@ -130,8 +130,8 @@ def test_pipeline(self, model_arch):
_ = pipe(text)
self.assertEqual(pipe.device, model.device)

@require_bitsandbytes
@parameterized.expand(SUPPORTED_ARCHITECTURES)
@unittest.skipIf(not is_bitsandbytes_available(), reason="Test requires bitsandbytes")
def test_bnb(self, model_arch):
model_id = MODEL_NAMES[model_arch]
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
Expand Down Expand Up @@ -248,8 +248,8 @@ def test_patched_model(self):
self.assertTrue(torch.allclose(outputs.start_logits, transformers_outputs.start_logits, atol=1e-4))
self.assertTrue(torch.allclose(outputs.end_logits, transformers_outputs.end_logits, atol=1e-4))

@require_bitsandbytes
@parameterized.expand(SUPPORTED_ARCHITECTURES)
@unittest.skipIf(not is_bitsandbytes_available(), reason="Test requires bitsandbytes")
def test_bnb(self, model_arch):
model_id = MODEL_NAMES[model_arch]
set_seed(SEED)
Expand Down Expand Up @@ -475,8 +475,8 @@ def test_patched_model(self, model_arch):
)
self.assertTrue(torch.allclose(ipex_outputs.logits[0], exported_outputs.logits[0], atol=1e-7))

@require_bitsandbytes
@parameterized.expand(SUPPORTED_ARCHITECTURES)
@unittest.skipIf(not is_bitsandbytes_available(), reason="Test requires bitsandbytes")
def test_bnb(self, model_arch):
model_id = MODEL_NAMES[model_arch]
set_seed(SEED)
Expand Down Expand Up @@ -765,8 +765,8 @@ def test_ipex_beam_search(self, test_name, model_arch, use_cache):
self.assertIsInstance(outputs, torch.Tensor)
self.assertTrue(torch.equal(outputs, transformers_outputs))

@require_bitsandbytes
@parameterized.expand(SUPPORTED_ARCHITECTURES)
@unittest.skipIf(not is_bitsandbytes_available(), reason="Test requires bitsandbytes")
def test_bnb(self, model_arch):
model_id = MODEL_NAMES[model_arch]
set_seed(SEED)
Expand Down

0 comments on commit 30027ff

Please sign in to comment.