Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
55871dd
ENH: Use HF Hub for model weights and avoid imagenet weight downloading
mostafajahanifar Jul 11, 2025
b9dda0b
MAIN: no more download_data for model weights
mostafajahanifar Jul 11, 2025
c214608
MAINT: add huggingface_hub to requirements
mostafajahanifar Jul 11, 2025
ba874d5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 11, 2025
54ded49
ENH: adding overwrite option to force download files
mostafajahanifar Jul 11, 2025
3081922
Merge branch 'enhance-hf-weights' of https://github.com/TissueImageAn…
mostafajahanifar Jul 11, 2025
53352b7
BUG: replace cache_dir wirh local_dir for specify the saving directory
mostafajahanifar Jul 14, 2025
59d6e93
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 14, 2025
abe6f3d
MAIN: pin the huggingface_hub version
mostafajahanifar Jul 14, 2025
9e18775
Merge branch 'enhance-hf-weights' of https://github.com/TissueImageAn…
mostafajahanifar Jul 14, 2025
ad222c9
BUG: fix type checking
mostafajahanifar Jul 18, 2025
0b52138
Merge branch 'develop' into enhance-hf-weights
shaneahmed Jul 25, 2025
41ba556
Merge branch 'develop' into enhance-hf-weights
shaneahmed Aug 5, 2025
6721567
Merge branch 'develop' into enhance-hf-weights
shaneahmed Aug 8, 2025
c53b7b2
Merge branch 'develop' into enhance-hf-weights
shaneahmed Sep 2, 2025
630ee1c
Merge branch 'develop' into enhance-hf-weights
shaneahmed Oct 2, 2025
fb1ed53
Merge branch 'develop' into enhance-hf-weights
shaneahmed Oct 10, 2025
caff2ea
address comments
Jiaqi-Lv Oct 10, 2025
30f3492
Merge branch 'develop' into enhance-hf-weights
shaneahmed Oct 16, 2025
7cd2357
update docstring
Jiaqi-Lv Oct 16, 2025
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
1 change: 1 addition & 0 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ filelock>=3.9.0
flask>=2.2.2
flask-cors>=4.0.0
glymur>=0.12.7
huggingface_hub>=0.33.3
imagecodecs>=2022.9.26
joblib>=1.1.1
jupyterlab>=3.5.2
Expand Down
13 changes: 8 additions & 5 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,21 +1618,24 @@ def test_from_multi_head_dat_type_dict(tmp_path: Path) -> None:

def test_fetch_pretrained_weights(tmp_path: Path) -> None:
"""Test fetching pretrained weights for a model."""
file_path = tmp_path / "test_fetch_pretrained_weights.pth"
model_name = "mobilenet_v3_small-pcam"
file_path = tmp_path / f"{model_name}.pth"
if file_path.exists():
file_path.unlink()

fetch_pretrained_weights(model_name="mobilenet_v3_small-pcam", save_path=file_path)
_ = fetch_pretrained_weights(
model_name="mobilenet_v3_small-pcam", save_path=tmp_path
)

assert file_path.exists()
assert file_path.stat().st_size > 0
file_path.unlink()

with pytest.raises(ValueError, match="does not exist"):
fetch_pretrained_weights("abc", file_path)
fetch_pretrained_weights("abc", tmp_path)

# Test save_path is str
file_path_str = str(file_path)
file_path = fetch_pretrained_weights("mobilenet_v3_small-pcam", file_path_str)
file_path = fetch_pretrained_weights(model_name, str(tmp_path))
assert Path(file_path).exists()
assert Path(file_path).stat().st_size > 0

Expand Down
Loading
Loading