Skip to content

Commit e2a1bc0

Browse files
Trigger CI test
1 parent 6c37c44 commit e2a1bc0

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

.github/workflows/python-tests.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ jobs:
4040
python -m pip install poetry
4141
poetry config virtualenvs.create false
4242
poetry install --no-interaction --no-ansi --without dev,docs
43-
43+
44+
- name: Compute Model Cache Key
45+
id: model_cache_key
46+
run: echo "MODEL_HASH=$(python tests/get_all_model_hash.py)" >> $GITHUB_ENV
47+
4448
- name: Set Model Cache Directory
4549
run: |
4650
if [[ "$RUNNER_OS" == "Windows" ]]; then
@@ -56,7 +60,7 @@ jobs:
5660
uses: actions/cache@v4
5761
with:
5862
path: "${{ env.MODEL_CACHE_DIR }}"
59-
key: ml-models-cache-${{ hashFiles('**/test_*.py') }}
63+
key: ml-models-cache-${{ env.MODEL_HASH }}"
6064
restore-keys: |
6165
ml-models-cache-
6266
enableCrossOsArchive: true

tests/get_all_model_hash.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import hashlib
2+
3+
from fastembed import (
4+
TextEmbedding,
5+
LateInteractionTextEmbedding,
6+
SparseTextEmbedding,
7+
ImageEmbedding,
8+
LateInteractionMultimodalEmbedding,
9+
)
10+
from fastembed.rerank.cross_encoder import TextCrossEncoder
11+
12+
13+
models = [
14+
*TextEmbedding.list_supported_models(),
15+
*ImageEmbedding.list_supported_models(),
16+
*LateInteractionTextEmbedding.list_supported_models(),
17+
*LateInteractionMultimodalEmbedding.list_supported_models(),
18+
*TextCrossEncoder.list_supported_models(),
19+
*SparseTextEmbedding.list_supported_models(),
20+
]
21+
22+
model_names = sorted(set([model["model"] for model in models]))
23+
24+
hash_value = hashlib.sha256("".join(model_names).encode()).hexdigest()
25+
26+
print(hash_value)

0 commit comments

Comments
 (0)