Skip to content

Commit d609287

Browse files
Trigger CI
1 parent ca3bf8d commit d609287

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

.github/workflows/python-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
6161
- name: Run pytest
6262
run: |
63-
poetry run pytest
63+
poetry run pytest tests/test_image_onnx_embeddings.py
6464
6565
- name: List Cached Models (Windows)
6666
if: runner.os == 'Windows'

tests/utils.py

+30-33
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
1-
import shutil
2-
import traceback
3-
41
from pathlib import Path
5-
from types import TracebackType
6-
from typing import Union, Callable, Any, Type
2+
from typing import Union
73

84

95
def delete_model_cache(model_dir: Union[str, Path]) -> None:
10-
"""Delete the model cache directory.
11-
12-
If a model was downloaded from the HuggingFace model hub, then _model_dir is the dir to snapshots, removing
13-
it won't help to release the memory, because data is in blobs directory.
14-
If a model was downloaded from GCS, then we can just remove model_dir
15-
16-
Args:
17-
model_dir (Union[str, Path]): The path to the model cache directory.
18-
"""
19-
20-
def on_error(
21-
func: Callable[..., Any],
22-
path: str,
23-
exc_info: tuple[Type[BaseException], BaseException, TracebackType],
24-
) -> None:
25-
print("Failed to remove: ", path)
26-
print("Exception: ", exc_info)
27-
traceback.print_exception(*exc_info)
28-
29-
if isinstance(model_dir, str):
30-
model_dir = Path(model_dir)
31-
32-
if model_dir.parent.parent.name.startswith("models--"):
33-
model_dir = model_dir.parent.parent
34-
35-
if model_dir.exists():
36-
# todo: PermissionDenied is raised on blobs removal in Windows, with blobs > 2GB
37-
shutil.rmtree(model_dir, onerror=on_error)
6+
# """Delete the model cache directory.
7+
8+
# If a model was downloaded from the HuggingFace model hub, then _model_dir is the dir to snapshots, removing
9+
# it won't help to release the memory, because data is in blobs directory.
10+
# If a model was downloaded from GCS, then we can just remove model_dir
11+
12+
# Args:
13+
# model_dir (Union[str, Path]): The path to the model cache directory.
14+
# """
15+
16+
# def on_error(
17+
# func: Callable[..., Any],
18+
# path: str,
19+
# exc_info: tuple[Type[BaseException], BaseException, TracebackType],
20+
# ) -> None:
21+
# print("Failed to remove: ", path)
22+
# print("Exception: ", exc_info)
23+
# traceback.print_exception(*exc_info)
24+
25+
# if isinstance(model_dir, str):
26+
# model_dir = Path(model_dir)
27+
28+
# if model_dir.parent.parent.name.startswith("models--"):
29+
# model_dir = model_dir.parent.parent
30+
31+
# if model_dir.exists():
32+
# # todo: PermissionDenied is raised on blobs removal in Windows, with blobs > 2GB
33+
# shutil.rmtree(model_dir, onerror=on_error)
34+
pass

0 commit comments

Comments
 (0)