chore: update
Browse files- .pre-commit-config.yaml +1 -1
- models.py +7 -7
- pdm.lock +46 -30
- pyproject.toml +1 -0
.pre-commit-config.yaml
CHANGED
|
@@ -19,7 +19,7 @@ repos:
|
|
| 19 |
- id: prettier
|
| 20 |
|
| 21 |
- repo: https://github.com/astral-sh/ruff-pre-commit
|
| 22 |
-
rev: v0.4.
|
| 23 |
hooks:
|
| 24 |
- id: ruff
|
| 25 |
args: [--fix, --exit-non-zero-on-fix]
|
|
|
|
| 19 |
- id: prettier
|
| 20 |
|
| 21 |
- repo: https://github.com/astral-sh/ruff-pre-commit
|
| 22 |
+
rev: v0.4.7
|
| 23 |
hooks:
|
| 24 |
- id: ruff
|
| 25 |
args: [--fix, --exit-non-zero-on-fix]
|
models.py
CHANGED
|
@@ -39,9 +39,7 @@ model_info = [
|
|
| 39 |
|
| 40 |
|
| 41 |
def download(model: str, repo: str) -> str:
|
| 42 |
-
return hf_hub_download(
|
| 43 |
-
repo, model, local_dir="downloads", local_dir_use_symlinks=False
|
| 44 |
-
)
|
| 45 |
|
| 46 |
|
| 47 |
def export(path: str) -> str:
|
|
@@ -54,15 +52,17 @@ def main():
|
|
| 54 |
save.mkdir(exist_ok=True)
|
| 55 |
|
| 56 |
pbar = tqdm(model_info)
|
|
|
|
| 57 |
with ThreadPoolExecutor() as executor:
|
| 58 |
-
|
| 59 |
-
for repo, model in tqdm(model_info):
|
| 60 |
fu = executor.submit(download, model, repo)
|
| 61 |
fu.add_done_callback(lambda _: pbar.update())
|
| 62 |
fs.append(fu)
|
| 63 |
|
| 64 |
-
for
|
| 65 |
-
|
|
|
|
|
|
|
| 66 |
onnx = export(path)
|
| 67 |
target_dir = save / Path(model).stem
|
| 68 |
(target_dir / "1").mkdir(exist_ok=True, parents=True)
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
def download(model: str, repo: str) -> str:
|
| 42 |
+
return hf_hub_download(repo, model, local_dir="downloads")
|
|
|
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
def export(path: str) -> str:
|
|
|
|
| 52 |
save.mkdir(exist_ok=True)
|
| 53 |
|
| 54 |
pbar = tqdm(model_info)
|
| 55 |
+
fs = []
|
| 56 |
with ThreadPoolExecutor() as executor:
|
| 57 |
+
for repo, model in model_info:
|
|
|
|
| 58 |
fu = executor.submit(download, model, repo)
|
| 59 |
fu.add_done_callback(lambda _: pbar.update())
|
| 60 |
fs.append(fu)
|
| 61 |
|
| 62 |
+
paths = [fu.result() for fu in fs]
|
| 63 |
+
pbar.close()
|
| 64 |
+
|
| 65 |
+
for path in paths:
|
| 66 |
onnx = export(path)
|
| 67 |
target_dir = save / Path(model).stem
|
| 68 |
(target_dir / "1").mkdir(exist_ok=True, parents=True)
|
pdm.lock
CHANGED
|
@@ -5,7 +5,7 @@
|
|
| 5 |
groups = ["default", "dev"]
|
| 6 |
strategy = ["cross_platform", "inherit_metadata"]
|
| 7 |
lock_version = "4.4.1"
|
| 8 |
-
content_hash = "sha256:
|
| 9 |
|
| 10 |
[[package]]
|
| 11 |
name = "certifi"
|
|
@@ -746,6 +746,22 @@ files = [
|
|
| 746 |
{file = "onnxsim-0.4.36.tar.gz", hash = "sha256:6e0ee9d6d4a83042bdef7319fbe58352d9fda5f253386be2b267c7c27f0638ee"},
|
| 747 |
]
|
| 748 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 749 |
[[package]]
|
| 750 |
name = "opencv-python"
|
| 751 |
version = "4.9.0.80"
|
|
@@ -891,18 +907,18 @@ files = [
|
|
| 891 |
|
| 892 |
[[package]]
|
| 893 |
name = "protobuf"
|
| 894 |
-
version = "
|
| 895 |
requires_python = ">=3.8"
|
| 896 |
summary = ""
|
| 897 |
groups = ["default"]
|
| 898 |
files = [
|
| 899 |
-
{file = "protobuf-
|
| 900 |
-
{file = "protobuf-
|
| 901 |
-
{file = "protobuf-
|
| 902 |
-
{file = "protobuf-
|
| 903 |
-
{file = "protobuf-
|
| 904 |
-
{file = "protobuf-
|
| 905 |
-
{file = "protobuf-
|
| 906 |
]
|
| 907 |
|
| 908 |
[[package]]
|
|
@@ -1047,28 +1063,28 @@ files = [
|
|
| 1047 |
|
| 1048 |
[[package]]
|
| 1049 |
name = "ruff"
|
| 1050 |
-
version = "0.4.
|
| 1051 |
requires_python = ">=3.7"
|
| 1052 |
summary = "An extremely fast Python linter and code formatter, written in Rust."
|
| 1053 |
groups = ["dev"]
|
| 1054 |
files = [
|
| 1055 |
-
{file = "ruff-0.4.
|
| 1056 |
-
{file = "ruff-0.4.
|
| 1057 |
-
{file = "ruff-0.4.
|
| 1058 |
-
{file = "ruff-0.4.
|
| 1059 |
-
{file = "ruff-0.4.
|
| 1060 |
-
{file = "ruff-0.4.
|
| 1061 |
-
{file = "ruff-0.4.
|
| 1062 |
-
{file = "ruff-0.4.
|
| 1063 |
-
{file = "ruff-0.4.
|
| 1064 |
-
{file = "ruff-0.4.
|
| 1065 |
-
{file = "ruff-0.4.
|
| 1066 |
-
{file = "ruff-0.4.
|
| 1067 |
-
{file = "ruff-0.4.
|
| 1068 |
-
{file = "ruff-0.4.
|
| 1069 |
-
{file = "ruff-0.4.
|
| 1070 |
-
{file = "ruff-0.4.
|
| 1071 |
-
{file = "ruff-0.4.
|
| 1072 |
]
|
| 1073 |
|
| 1074 |
[[package]]
|
|
@@ -1285,7 +1301,7 @@ files = [
|
|
| 1285 |
|
| 1286 |
[[package]]
|
| 1287 |
name = "ultralytics"
|
| 1288 |
-
version = "8.2.
|
| 1289 |
requires_python = ">=3.8"
|
| 1290 |
summary = "Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification."
|
| 1291 |
groups = ["default"]
|
|
@@ -1306,8 +1322,8 @@ dependencies = [
|
|
| 1306 |
"tqdm>=4.64.0",
|
| 1307 |
]
|
| 1308 |
files = [
|
| 1309 |
-
{file = "ultralytics-8.2.
|
| 1310 |
-
{file = "ultralytics-8.2.
|
| 1311 |
]
|
| 1312 |
|
| 1313 |
[[package]]
|
|
|
|
| 5 |
groups = ["default", "dev"]
|
| 6 |
strategy = ["cross_platform", "inherit_metadata"]
|
| 7 |
lock_version = "4.4.1"
|
| 8 |
+
content_hash = "sha256:659b132ba542d46c3673238a3cd96727a02f50d2d594d7ac63290ea66ee23092"
|
| 9 |
|
| 10 |
[[package]]
|
| 11 |
name = "certifi"
|
|
|
|
| 746 |
{file = "onnxsim-0.4.36.tar.gz", hash = "sha256:6e0ee9d6d4a83042bdef7319fbe58352d9fda5f253386be2b267c7c27f0638ee"},
|
| 747 |
]
|
| 748 |
|
| 749 |
+
[[package]]
|
| 750 |
+
name = "onnxslim"
|
| 751 |
+
version = "0.1.28"
|
| 752 |
+
requires_python = ">=3.6"
|
| 753 |
+
summary = "OnnxSlim: A Toolkit to Help Optimize Large Onnx Model"
|
| 754 |
+
groups = ["default"]
|
| 755 |
+
dependencies = [
|
| 756 |
+
"onnx",
|
| 757 |
+
"packaging",
|
| 758 |
+
"sympy",
|
| 759 |
+
]
|
| 760 |
+
files = [
|
| 761 |
+
{file = "onnxslim-0.1.28-py3-none-any.whl", hash = "sha256:93adbdcd54f1d7591c86e8d0c00e514b712040cf6080bfd7ac6d6b92add89802"},
|
| 762 |
+
{file = "onnxslim-0.1.28.tar.gz", hash = "sha256:590028bee9c8e5e644ada4c6374f86b23db2f2edd4917e929eef36f4c68e2422"},
|
| 763 |
+
]
|
| 764 |
+
|
| 765 |
[[package]]
|
| 766 |
name = "opencv-python"
|
| 767 |
version = "4.9.0.80"
|
|
|
|
| 907 |
|
| 908 |
[[package]]
|
| 909 |
name = "protobuf"
|
| 910 |
+
version = "4.25.3"
|
| 911 |
requires_python = ">=3.8"
|
| 912 |
summary = ""
|
| 913 |
groups = ["default"]
|
| 914 |
files = [
|
| 915 |
+
{file = "protobuf-4.25.3-cp310-abi3-win32.whl", hash = "sha256:d4198877797a83cbfe9bffa3803602bbe1625dc30d8a097365dbc762e5790faa"},
|
| 916 |
+
{file = "protobuf-4.25.3-cp310-abi3-win_amd64.whl", hash = "sha256:209ba4cc916bab46f64e56b85b090607a676f66b473e6b762e6f1d9d591eb2e8"},
|
| 917 |
+
{file = "protobuf-4.25.3-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:f1279ab38ecbfae7e456a108c5c0681e4956d5b1090027c1de0f934dfdb4b35c"},
|
| 918 |
+
{file = "protobuf-4.25.3-cp37-abi3-manylinux2014_aarch64.whl", hash = "sha256:e7cb0ae90dd83727f0c0718634ed56837bfeeee29a5f82a7514c03ee1364c019"},
|
| 919 |
+
{file = "protobuf-4.25.3-cp37-abi3-manylinux2014_x86_64.whl", hash = "sha256:7c8daa26095f82482307bc717364e7c13f4f1c99659be82890dcfc215194554d"},
|
| 920 |
+
{file = "protobuf-4.25.3-py3-none-any.whl", hash = "sha256:f0700d54bcf45424477e46a9f0944155b46fb0639d69728739c0e47bab83f2b9"},
|
| 921 |
+
{file = "protobuf-4.25.3.tar.gz", hash = "sha256:25b5d0b42fd000320bd7830b349e3b696435f3b329810427a6bcce6a5492cc5c"},
|
| 922 |
]
|
| 923 |
|
| 924 |
[[package]]
|
|
|
|
| 1063 |
|
| 1064 |
[[package]]
|
| 1065 |
name = "ruff"
|
| 1066 |
+
version = "0.4.7"
|
| 1067 |
requires_python = ">=3.7"
|
| 1068 |
summary = "An extremely fast Python linter and code formatter, written in Rust."
|
| 1069 |
groups = ["dev"]
|
| 1070 |
files = [
|
| 1071 |
+
{file = "ruff-0.4.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e089371c67892a73b6bb1525608e89a2aca1b77b5440acf7a71dda5dac958f9e"},
|
| 1072 |
+
{file = "ruff-0.4.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:10f973d521d910e5f9c72ab27e409e839089f955be8a4c8826601a6323a89753"},
|
| 1073 |
+
{file = "ruff-0.4.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:59c3d110970001dfa494bcd95478e62286c751126dfb15c3c46e7915fc49694f"},
|
| 1074 |
+
{file = "ruff-0.4.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fa9773c6c00f4958f73b317bc0fd125295110c3776089f6ef318f4b775f0abe4"},
|
| 1075 |
+
{file = "ruff-0.4.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07fc80bbb61e42b3b23b10fda6a2a0f5a067f810180a3760c5ef1b456c21b9db"},
|
| 1076 |
+
{file = "ruff-0.4.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:fa4dafe3fe66d90e2e2b63fa1591dd6e3f090ca2128daa0be33db894e6c18648"},
|
| 1077 |
+
{file = "ruff-0.4.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a7c0083febdec17571455903b184a10026603a1de078428ba155e7ce9358c5f6"},
|
| 1078 |
+
{file = "ruff-0.4.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ad1b20e66a44057c326168437d680a2166c177c939346b19c0d6b08a62a37589"},
|
| 1079 |
+
{file = "ruff-0.4.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cbf5d818553add7511c38b05532d94a407f499d1a76ebb0cad0374e32bc67202"},
|
| 1080 |
+
{file = "ruff-0.4.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:50e9651578b629baec3d1513b2534de0ac7ed7753e1382272b8d609997e27e83"},
|
| 1081 |
+
{file = "ruff-0.4.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:8874a9df7766cb956b218a0a239e0a5d23d9e843e4da1e113ae1d27ee420877a"},
|
| 1082 |
+
{file = "ruff-0.4.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:b9de9a6e49f7d529decd09381c0860c3f82fa0b0ea00ea78409b785d2308a567"},
|
| 1083 |
+
{file = "ruff-0.4.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:13a1768b0691619822ae6d446132dbdfd568b700ecd3652b20d4e8bc1e498f78"},
|
| 1084 |
+
{file = "ruff-0.4.7-py3-none-win32.whl", hash = "sha256:769e5a51df61e07e887b81e6f039e7ed3573316ab7dd9f635c5afaa310e4030e"},
|
| 1085 |
+
{file = "ruff-0.4.7-py3-none-win_amd64.whl", hash = "sha256:9e3ab684ad403a9ed1226894c32c3ab9c2e0718440f6f50c7c5829932bc9e054"},
|
| 1086 |
+
{file = "ruff-0.4.7-py3-none-win_arm64.whl", hash = "sha256:10f2204b9a613988e3484194c2c9e96a22079206b22b787605c255f130db5ed7"},
|
| 1087 |
+
{file = "ruff-0.4.7.tar.gz", hash = "sha256:2331d2b051dc77a289a653fcc6a42cce357087c5975738157cd966590b18b5e1"},
|
| 1088 |
]
|
| 1089 |
|
| 1090 |
[[package]]
|
|
|
|
| 1301 |
|
| 1302 |
[[package]]
|
| 1303 |
name = "ultralytics"
|
| 1304 |
+
version = "8.2.27"
|
| 1305 |
requires_python = ">=3.8"
|
| 1306 |
summary = "Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification."
|
| 1307 |
groups = ["default"]
|
|
|
|
| 1322 |
"tqdm>=4.64.0",
|
| 1323 |
]
|
| 1324 |
files = [
|
| 1325 |
+
{file = "ultralytics-8.2.27-py3-none-any.whl", hash = "sha256:bd00d487fc68360667a906292ccf21ba1b7022604c3ac5c74369b808bcdfec87"},
|
| 1326 |
+
{file = "ultralytics-8.2.27.tar.gz", hash = "sha256:70cc1ce7af33a53d2f0f449ba709a0fd28edb5f2571b69f47d6fa05def458194"},
|
| 1327 |
]
|
| 1328 |
|
| 1329 |
[[package]]
|
pyproject.toml
CHANGED
|
@@ -9,6 +9,7 @@ dependencies = [
|
|
| 9 |
"onnx",
|
| 10 |
"onnxruntime",
|
| 11 |
"onnxsim",
|
|
|
|
| 12 |
]
|
| 13 |
requires-python = ">=3.11"
|
| 14 |
readme = "README.md"
|
|
|
|
| 9 |
"onnx",
|
| 10 |
"onnxruntime",
|
| 11 |
"onnxsim",
|
| 12 |
+
"onnxslim",
|
| 13 |
]
|
| 14 |
requires-python = ">=3.11"
|
| 15 |
readme = "README.md"
|