Commit e2a1bc0 1 parent 6c37c44 commit e2a1bc0 Copy full SHA for e2a1bc0
File tree 2 files changed +32
-2
lines changed
2 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 40
40
python -m pip install poetry
41
41
poetry config virtualenvs.create false
42
42
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
+
44
48
- name : Set Model Cache Directory
45
49
run : |
46
50
if [[ "$RUNNER_OS" == "Windows" ]]; then
56
60
uses : actions/cache@v4
57
61
with :
58
62
path : " ${{ env.MODEL_CACHE_DIR }}"
59
- key : ml-models-cache-${{ hashFiles('**/test_*.py') }}
63
+ key : ml-models-cache-${{ env.MODEL_HASH }}"
60
64
restore-keys : |
61
65
ml-models-cache-
62
66
enableCrossOsArchive : true
Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments