Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Python 3.12 #1

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand Down Expand Up @@ -78,6 +78,10 @@ jobs:
with:
name: "wheel-3.11"
path: "dist/"
- uses: actions/download-artifact@v2
with:
name: "wheel-3.12"
path: "dist/"
- run: |
ls -lh dist/
- name: Setup PyPI config
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
experimental: [false]
steps:
- uses: actions/checkout@v3
Expand Down
13 changes: 4 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,13 @@
import os
import subprocess
import sys
from distutils.version import LooseVersion

import setuptools.command.build_py
import setuptools.command.develop
from setuptools import find_packages, setup

if LooseVersion(sys.version) < LooseVersion("3.6") or LooseVersion(
sys.version
) > LooseVersion("3.12"):
raise RuntimeError(
"Trainer requires python >= 3.6 and <=3.12 "
"but your Python version is {}".format(sys.version)
)
if sys.version_info < (3, 6) or sys.version_info >= (3, 13):
raise RuntimeError("Trainer requires python >= 3.6 and <3.13 " "but your Python version is {}".format(sys.version))


cwd = os.path.dirname(os.path.abspath(__file__))
Expand Down Expand Up @@ -105,7 +99,7 @@ def pip_install(package_name):
"test": requirements_test,
"all": requirements_all
},
python_requires=">=3.6.0, <3.12",
python_requires=">=3.6.0, <3.13",
classifiers=[
"Environment :: Console",
"Natural Language :: English",
Expand All @@ -123,6 +117,7 @@ def pip_install(package_name):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
zip_safe=False,
)
3 changes: 1 addition & 2 deletions trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,7 @@ def master_params(optimizer: torch.optim.Optimizer):
optimizer: Target optimizer.
"""
for group in optimizer.param_groups:
for p in group["params"]:
yield p
yield from group["params"]

@staticmethod
def _model_train_step(
Expand Down
Loading