From d2e580a8905fa3da0dc1579f6d44f0e14ce8ab8f Mon Sep 17 00:00:00 2001 From: "Nicholas M. Synovic" Date: Thu, 26 Jan 2023 20:51:27 -0600 Subject: [PATCH 1/3] Improve error checking --- ptm_torrent/huggingface/__main__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ptm_torrent/huggingface/__main__.py b/ptm_torrent/huggingface/__main__.py index 54a55a2..83e900e 100644 --- a/ptm_torrent/huggingface/__main__.py +++ b/ptm_torrent/huggingface/__main__.py @@ -3,8 +3,8 @@ import ptm_torrent.huggingface.createSchema as createSchema import ptm_torrent.huggingface.downloadJSON as downloadJSON import ptm_torrent.huggingface.downloadRepos as downloadRepos -import ptm_torrent.huggingface.splitRepos as splitRepos import ptm_torrent.huggingface.setupFileSystem as setupFS +import ptm_torrent.huggingface.splitRepos as splitRepos if __name__ == "__main__": shrinkage: float | str | None @@ -12,14 +12,14 @@ shrinkageEnvironmentVariable: str = "HF_TORRENT_SHRINKAGE" shrinkageEnvironmentValue: str = environ.get(shrinkageEnvironmentVariable) - if shrinkageEnvironmentValue is None: - shrinkage = 0.1 - try: shrinkage = float(shrinkageEnvironmentValue) except ValueError: print(f"Invalid value for {shrinkageEnvironmentVariable}. Defaulting to 0.1") shrinkage = 0.1 + except TypeError: + print(f"Invalid value for {shrinkageEnvironmentVariable}. Defaulting to 0.1") + shrinkage = 0.1 if shrinkage > 1 or shrinkage <= 0: print(f"Invalid value for {shrinkageEnvironmentVariable}. Defaulting to 0.1") From de52e7c04c4b3c64ddddbe48816860308d4344a1 Mon Sep 17 00:00:00 2001 From: "Nicholas M. Synovic" Date: Thu, 26 Jan 2023 21:18:52 -0600 Subject: [PATCH 2/3] Test and validate example scripts --- .gitignore | 2 ++ example/README.md | 2 +- example/example.py | 2 +- example/run.bash | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9571e7a..01af35e 100644 --- a/.gitignore +++ b/.gitignore @@ -169,3 +169,5 @@ ptm_torrent/huggingface/v2/data ptm_torrent/huggingface/v3/data ptm_torrent/pytorchhub/data example/onnx +example/PTMTorrent +example/onnxmodelzoo.tar.gz diff --git a/example/README.md b/example/README.md index 57c4c34..3c478e7 100644 --- a/example/README.md +++ b/example/README.md @@ -39,7 +39,7 @@ Python dependencies are managed with `pip` and > Instructions were written for Linux operating systems 1. Change directories into the ONNX Model Zoo PTMTorrent directory: - `cd data/onnxmodelzoo` + `cd ptm_torrent/onnxmodelzoo` 1. Create a `Python 3.10` virtual environment: `python3.10 -m venv env` 1. Activate virtual environment: `source env/bin/activate` 1. Upgrade `pip`: `python -m pip install --upgrade pip` diff --git a/example/example.py b/example/example.py index 3817206..dbfbc1f 100644 --- a/example/example.py +++ b/example/example.py @@ -34,7 +34,7 @@ def extractAuthorRepo(url: str) -> PurePath: def main(): paths: List[PurePath] = [] - jsonFile: PurePath = PurePath("onnxmodelzoo.json") + jsonFile: PurePath = PurePath("json/onnxmodelzoo.json") json: List[dict] = readJSON(filepath=jsonFile) data: dict diff --git a/example/run.bash b/example/run.bash index b625565..2a3f643 100755 --- a/example/run.bash +++ b/example/run.bash @@ -1,4 +1,4 @@ #!/bin/bash python3.10 example.py | xargs -I % clime-git-commits-extract -d % && -clime-git-commits-graph +clime-git-commits-graph --x-label Days --y-label "Lines of Code" --title "ONNX Model Zoo Lines of Code per Day" From 2c9b49510cd80c963b4f5865105c44455c937633 Mon Sep 17 00:00:00 2001 From: "Nicholas M. Synovic" Date: Thu, 26 Jan 2023 21:56:13 -0600 Subject: [PATCH 3/3] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 3c2f700..ab6e0c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ptm-torrent" -version = "0.1.5" +version = "0.1.6" description = "" authors = ["Nicholas M. Synovic "] readme = "README.md"