From 3becf087bbec9826a6936565a2b7e9888e487181 Mon Sep 17 00:00:00 2001 From: lucidrains Date: Thu, 25 Sep 2025 06:21:13 -0700 Subject: [PATCH] have a language model address https://github.com/lucidrains/vit-pytorch/issues/348 --- .github/workflows/python-publish.yml | 4 +- .github/workflows/python-test.yml | 11 +++-- pyproject.toml | 63 +++++++++++++++++++++++++++ setup.py | 42 ------------------ tests/.DS_Store | Bin 0 -> 6148 bytes tests/{test.py => test_vit.py} | 2 +- 6 files changed, 71 insertions(+), 51 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py create mode 100644 tests/.DS_Store rename tests/{test.py => test_vit.py} (96%) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 3bfabfc..734546a 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -18,9 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index fe54d29..dab7019 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -18,18 +18,17 @@ jobs: python-version: [3.8, 3.9] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install pytest - python -m pip install wheel python -m pip install torch==2.4.0 torchvision==0.19.0 --index-url https://download.pytorch.org/whl/cpu - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python -m pip install -e . + python -m pip install pytest - name: Test with pytest run: | - python setup.py test + pytest -q diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..58336e8 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,63 @@ +[build-system] +requires = ["setuptools>=61", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "vit-pytorch" +version = "1.12.4" +description = "Vision Transformer (ViT) - Pytorch" +readme = { file = "README.md", content-type = "text/markdown" } +license = { file = "LICENSE" } +authors = [ + { name = "Phil Wang", email = "lucidrains@gmail.com" }, +] +requires-python = ">=3.8" +keywords = [ + "artificial intelligence", + "attention mechanism", + "image recognition", +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +dependencies = [ + "einops>=0.7.0", + "torch>=1.10", + "torchvision", +] + +[project.optional-dependencies] +test = [ + "pytest", + "torch==2.4.0", + "torchvision==0.19.0", +] + +[project.urls] +Homepage = "https://github.com/lucidrains/vit-pytorch" +Repository = "https://github.com/lucidrains/vit-pytorch" + +[tool.setuptools] +include-package-data = true + +[tool.setuptools.packages.find] +include = ["vit_pytorch*"] +exclude = ["examples*", "tests*", "test*"] + +[tool.pytest.ini_options] +testpaths = ["tests", "."] +python_files = ["test_*.py", "*_test.py"] +addopts = "-q" +filterwarnings = [ + "ignore::FutureWarning", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 7fdb521..0000000 --- a/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -from setuptools import setup, find_packages - -with open('README.md') as f: - long_description = f.read() - -setup( - name = 'vit-pytorch', - packages = find_packages(exclude=['examples']), - version = '1.12.2', - license='MIT', - description = 'Vision Transformer (ViT) - Pytorch', - long_description = long_description, - long_description_content_type = 'text/markdown', - author = 'Phil Wang', - author_email = 'lucidrains@gmail.com', - url = 'https://github.com/lucidrains/vit-pytorch', - keywords = [ - 'artificial intelligence', - 'attention mechanism', - 'image recognition' - ], - install_requires=[ - 'einops>=0.7.0', - 'torch>=1.10', - 'torchvision' - ], - setup_requires=[ - 'pytest-runner', - ], - tests_require=[ - 'pytest', - 'torch==2.4.0', - 'torchvision==0.19.0' - ], - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 3.6', - ], -) diff --git a/tests/.DS_Store b/tests/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0