Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/optimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.12"] # onnx does not support 3.13 yet

python-version: ["3.9", "3.13"]
steps:
- name: Support longpaths
if: matrix.os == 'windows-latest'
Expand Down Expand Up @@ -60,9 +60,16 @@ jobs:
- name: Run tests
run: hatch run cov-retry

- name: Run unit tests with lowest direct dependencies
run: |
hatch run uv pip compile pyproject.toml --resolution lowest-direct --output-file requirements_lowest_direct.txt
hatch run uv pip install -r requirements_lowest_direct.txt
hatch run test -m "not integration"

- name: Nightly - run unit tests with Haystack main branch
if: github.event_name == 'schedule'
run: |
hatch env prune
hatch run uv pip install git+https://github.com/deepset-ai/haystack.git@main
hatch run cov-retry -m "not integration"

Expand Down
2 changes: 1 addition & 1 deletion integrations/optimum/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies = [
# Ref: https://github.com/huggingface/optimum/blob/8651c0ca1cccf095458bc80329dec9df4601edb4/optimum/exporters/onnx/__main__.py#L164
# "sentence-transformers" has been added, since most embedding models use it
"sentence-transformers>=2.3",
"optimum[onnxruntime]",
"optimum[onnxruntime]>=1.17.0",
]

[project.urls]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_initialize_with_invalid_pooling_mode(self, mock_check_valid_model): #
model="sentence-transformers/all-mpnet-base-v2", pooling_mode="Invalid_pooling_mode"
)

def test_infer_pooling_mode_from_str(self):
def test_infer_pooling_mode_from_str(self, mock_check_valid_model): # noqa: ARG002
"""
Test that the pooling mode is correctly inferred from a string.
The pooling mode is "mean" as per the model config.
Expand Down Expand Up @@ -311,7 +311,7 @@ def test_prepare_texts_to_embed_w_suffix(self, mock_check_valid_model): # noqa:

def test_run_wrong_input_format(self, mock_check_valid_model): # noqa: ARG002
embedder = OptimumDocumentEmbedder(model="sentence-transformers/all-mpnet-base-v2", pooling_mode="mean")
embedder.warm_up()
embedder._initialized = True
# wrong formats
string_input = "text"
list_integers_input = [1, 2, 3]
Expand All @@ -326,7 +326,7 @@ def test_run_on_empty_list(self, mock_check_valid_model): # noqa: ARG002
embedder = OptimumDocumentEmbedder(
model="sentence-transformers/paraphrase-albert-small-v2",
)
embedder.warm_up()
embedder._initialized = True
empty_list_input = []
result = embedder.run(documents=empty_list_input)

Expand Down
2 changes: 1 addition & 1 deletion integrations/optimum/tests/test_optimum_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_initialize_with_invalid_pooling_mode(self, mock_check_valid_model): #
with pytest.raises(ValueError):
OptimumTextEmbedder(model="sentence-transformers/all-mpnet-base-v2", pooling_mode="Invalid_pooling_mode")

def test_infer_pooling_mode_from_str(self):
def test_infer_pooling_mode_from_str(self, mock_check_valid_model): # noqa: ARG002
"""
Test that the pooling mode is correctly inferred from a string.
The pooling mode is "mean" as per the model config.
Expand Down