Skip to content

Commit 0da40fa

Browse files
committed
add ipex readme and tests
Signed-off-by: jiqing-feng <[email protected]>
1 parent 0455f54 commit 0da40fa

File tree

4 files changed

+27
-1
lines changed

4 files changed

+27
-1
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
- name: Install dependencies
6262
run: |
6363
python -m pip install --upgrade pip
64-
python -m pip install '.[train, onnx, openvino, dev]'
64+
python -m pip install '.[train, onnx, openvino, ipex, dev]'
6565
6666
- name: Install model2vec
6767
run: python -m pip install model2vec

docs/installation.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ We recommend **Python 3.9+**, **[PyTorch 1.11.0+](https://pytorch.org/get-starte
44
* **Default:** This allows for loading, saving, and inference (i.e., getting embeddings) of models.
55
* **ONNX:** This allows for loading, saving, inference, optimizing, and quantizing of models using the ONNX backend.
66
* **OpenVINO:** This allows for loading, saving, and inference of models using the OpenVINO backend.
7+
* **IPEX:** This allows for loading, saving, and inference of models using the IPEX backend.
78
* **Default and Training**: Like **Default**, plus training.
89
* **Development**: All of the above plus some dependencies for developing Sentence Transformers, see [Editable Install](#editable-install).
910

@@ -37,6 +38,12 @@ Note that you can mix and match the various extras, e.g. ``pip install -U "sente
3738
3839
pip install -U "sentence-transformers[openvino]"
3940
41+
.. tab:: IPEX
42+
43+
::
44+
45+
pip install -U "sentence-transformers[ipex]"
46+
4047
.. tab:: Default and Training
4148
4249
::
@@ -87,6 +94,12 @@ Note that you can mix and match the various extras, e.g. ``pip install -U "sente
8794
8895
pip install -U "sentence-transformers[openvino]"
8996
97+
.. tab:: IPEX
98+
99+
::
100+
101+
pip install -U "sentence-transformers[ipex]"
102+
90103
.. tab:: Default and Training
91104
92105
::
@@ -139,6 +152,12 @@ You can install ``sentence-transformers`` directly from source to take advantage
139152
140153
pip install -U "sentence-transformers[openvino] @ git+https://github.com/UKPLab/sentence-transformers.git"
141154
155+
.. tab:: IPEX
156+
157+
::
158+
159+
pip install -U "sentence-transformers[ipex] @ git+https://github.com/UKPLab/sentence-transformers.git"
160+
142161
.. tab:: Default and Training
143162
144163
::

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ train = ["datasets", "accelerate>=0.20.3"]
5151
onnx = ["optimum[onnxruntime]>=1.23.1"]
5252
onnx-gpu = ["optimum[onnxruntime-gpu]>=1.23.1"]
5353
openvino = ["optimum-intel[openvino]>=1.20.0"]
54+
ipex = ["optimum-intel[ipex]>=1.20.0"]
5455
dev = ["datasets", "accelerate>=0.20.3", "pre-commit", "pytest", "pytest-cov", "peft"]
5556

5657
[build-system]

tests/test_backends.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
except ImportError:
1616
pytest.skip("OpenVINO and ONNX backends are not available", allow_module_level=True)
1717

18+
try:
19+
from optimum.intel import IPEXModel
20+
except ImportError:
21+
pytest.skip("IPEX backend is not available", allow_module_level=True)
22+
1823
from sentence_transformers import SentenceTransformer
1924

2025

@@ -24,6 +29,7 @@
2429
[
2530
("onnx", ORTModelForFeatureExtraction),
2631
("openvino", OVModelForFeatureExtraction),
32+
("ipex", IPEXModel)
2733
],
2834
)
2935
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)