Skip to content

Commit

Permalink
add ipex readme and 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 Nov 25, 2024
1 parent 0455f54 commit 0da40fa
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install '.[train, onnx, openvino, dev]'
python -m pip install '.[train, onnx, openvino, ipex, dev]'
- name: Install model2vec
run: python -m pip install model2vec
Expand Down
19 changes: 19 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ We recommend **Python 3.9+**, **[PyTorch 1.11.0+](https://pytorch.org/get-starte
* **Default:** This allows for loading, saving, and inference (i.e., getting embeddings) of models.
* **ONNX:** This allows for loading, saving, inference, optimizing, and quantizing of models using the ONNX backend.
* **OpenVINO:** This allows for loading, saving, and inference of models using the OpenVINO backend.
* **IPEX:** This allows for loading, saving, and inference of models using the IPEX backend.
* **Default and Training**: Like **Default**, plus training.
* **Development**: All of the above plus some dependencies for developing Sentence Transformers, see [Editable Install](#editable-install).

Expand Down Expand Up @@ -37,6 +38,12 @@ Note that you can mix and match the various extras, e.g. ``pip install -U "sente
pip install -U "sentence-transformers[openvino]"
.. tab:: IPEX
::
pip install -U "sentence-transformers[ipex]"
.. tab:: Default and Training
::
Expand Down Expand Up @@ -87,6 +94,12 @@ Note that you can mix and match the various extras, e.g. ``pip install -U "sente
pip install -U "sentence-transformers[openvino]"
.. tab:: IPEX
::
pip install -U "sentence-transformers[ipex]"
.. tab:: Default and Training
::
Expand Down Expand Up @@ -139,6 +152,12 @@ You can install ``sentence-transformers`` directly from source to take advantage
pip install -U "sentence-transformers[openvino] @ git+https://github.com/UKPLab/sentence-transformers.git"
.. tab:: IPEX
::
pip install -U "sentence-transformers[ipex] @ git+https://github.com/UKPLab/sentence-transformers.git"
.. tab:: Default and Training
::
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ train = ["datasets", "accelerate>=0.20.3"]
onnx = ["optimum[onnxruntime]>=1.23.1"]
onnx-gpu = ["optimum[onnxruntime-gpu]>=1.23.1"]
openvino = ["optimum-intel[openvino]>=1.20.0"]
ipex = ["optimum-intel[ipex]>=1.20.0"]
dev = ["datasets", "accelerate>=0.20.3", "pre-commit", "pytest", "pytest-cov", "peft"]

[build-system]
Expand Down
6 changes: 6 additions & 0 deletions tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
except ImportError:
pytest.skip("OpenVINO and ONNX backends are not available", allow_module_level=True)

try:
from optimum.intel import IPEXModel
except ImportError:
pytest.skip("IPEX backend is not available", allow_module_level=True)

from sentence_transformers import SentenceTransformer


Expand All @@ -24,6 +29,7 @@
[
("onnx", ORTModelForFeatureExtraction),
("openvino", OVModelForFeatureExtraction),
("ipex", IPEXModel)
],
)
@pytest.mark.parametrize(
Expand Down

0 comments on commit 0da40fa

Please sign in to comment.