-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add parallel test deps * Update signature * Add encoders tests * Update gitignore * Update encoders for timm-universal * Add parallel tests run * Disable models tests * Add uv to CI * Add uv to minimum * Add show-install-packages * Increase to 3 workers * Fix show-packages * Change back for 2 workers * Add coverage * Basic model test * Fix * Move model archs * Add base params test * Fix timm test for minimum version * Remove deprecated utils from coverage * Fix * Fix * Exclude conversion script * Add save-load test, add aux head test * Remove custom encoder * Set encoder for models tests * Docs + flag for anyres * Fix loading from config * Bump min hf-hub to 0.25.0 * Fix minimal * Add test with hub checkpoint * Fixing minimum * Fix * Fix torch for minimum tests * Update torch version and run-slow * run-slow * Show skipped * [run-slow] Fixing minimum * [run-slow] Fixing minimum * Fix decorator * Raise error * [run-slow] Fixing run slow * [run-slow] Fixing run slow * Run slow tests in separate job * FIx * Fixes * Add device * Bum tolerance * Add device * Fixup
- Loading branch information
Showing
42 changed files
with
1,046 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,7 @@ venv/ | |
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
.vscode/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import os | ||
import torch | ||
import tempfile | ||
import huggingface_hub | ||
import segmentation_models_pytorch as smp | ||
|
||
HUB_REPO = "smp-test-models" | ||
ENCODER_NAME = "tu-resnet18" | ||
|
||
api = huggingface_hub.HfApi(token=os.getenv("HF_TOKEN")) | ||
|
||
for model_name, model_class in smp.MODEL_ARCHITECTURES_MAPPING.items(): | ||
model = model_class(encoder_name=ENCODER_NAME) | ||
model = model.eval() | ||
|
||
# generate test sample | ||
torch.manual_seed(423553) | ||
sample = torch.rand(1, 3, 256, 256) | ||
|
||
with torch.no_grad(): | ||
output = model(sample) | ||
|
||
with tempfile.TemporaryDirectory() as tmpdir: | ||
# save model | ||
model.save_pretrained(f"{tmpdir}") | ||
|
||
# save input and output | ||
torch.save(sample, f"{tmpdir}/input-tensor.pth") | ||
torch.save(output, f"{tmpdir}/output-tensor.pth") | ||
|
||
# create repo | ||
repo_id = f"{HUB_REPO}/{model_name}-{ENCODER_NAME}" | ||
if not api.repo_exists(repo_id=repo_id): | ||
api.create_repo(repo_id=repo_id, repo_type="model") | ||
|
||
# upload to hub | ||
api.upload_folder( | ||
folder_path=tmpdir, | ||
repo_id=f"{HUB_REPO}/{model_name}-{ENCODER_NAME}", | ||
repo_type="model", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ timm==0.9.0 | |
torch==1.9.0 | ||
torchvision==0.10.0 | ||
tqdm==4.42.1 | ||
Jinja2==3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
pytest==8.3.4 | ||
ruff==0.8.4 | ||
pytest-xdist==3.6.1 | ||
pytest-cov==6.0.0 | ||
ruff==0.8.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.