From 106932b74ce1d750fdacd297e6330012ca2cb26f Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Mon, 26 Feb 2024 11:52:00 +0800 Subject: [PATCH] chore: python 3.12 update, close #2 --- README.md | 2 +- pyproject.toml | 11 ++++++----- src/torchattack/__init__.py | 2 ++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 78ff1de..42409a7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Load a model model = resnet50(weights='DEFAULT') -model = model.to(device) +model = model.eval().to(device) # Define normalization (you are responsible for normalizing the data if needed) normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) diff --git a/pyproject.toml b/pyproject.toml index 31db9ac..bf8b35e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,8 @@ [project] name = "torchattack" -version = "0.3.0" description = "A set of adversarial attacks implemented in PyTorch" authors = [{ name = "spencerwooo", email = "spencer.woo@outlook.com" }] -requires-python = ">=3.10,<3.12" +requires-python = ">=3.10,<3.13" readme = "README.md" license = { text = "MIT" } dependencies = [ @@ -13,14 +12,16 @@ dependencies = [ "scipy>=1.10.1", "rich>=13.3.5", ] - -[project.optional-dependencies] -dev = ["mypy"] +dynamic = ["version"] +optional-dependencies = { dev = ["mypy"] } [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" +[tool.setuptools.dynamic] +version = { attr = "torchattack.__version__" } + [tool.ruff] line-length = 88 select = ["E", "F", "I", "N", "B", "SIM"] diff --git a/src/torchattack/__init__.py b/src/torchattack/__init__.py index 6d20082..7c71a31 100644 --- a/src/torchattack/__init__.py +++ b/src/torchattack/__init__.py @@ -12,6 +12,8 @@ from torchattack.vmifgsm import VMIFGSM from torchattack.vnifgsm import VNIFGSM +__version__ = '0.4.0' + __all__ = [ 'Admix', 'DeepFool',