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

python 3.12 support #841

Merged
merged 11 commits into from
Dec 5, 2024
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
token: ${{ secrets.GH_TOKEN_FOR_WORKFLOWS_ENTERPRISE }}
- uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
check-latest: true
- run: pip install mkdocs-material
- run: pip install "mkdocstrings[python]"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/hosted_inference_e2e_test_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: 🐍 Set up Python 3.10
- name: 🐍 Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: 📦 Cache Python packages
uses: actions/cache@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/hosted_inference_e2e_test_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: 🐍 Set up Python 3.10
- name: 🐍 Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: 📦 Cache Python packages
uses: actions/cache@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests_inference_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
timeout-minutes: 45
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests_workflows_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
group: public-depot
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 15
steps:
- name: 🛎️ Checkout
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/load_test_hosted_inference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: 🐍 Set up Python 3.10
- name: 🐍 Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: 📦 Cache Python packages
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
python-version: [3.9]
python-version: ["3.12"]
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_package_install_inference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
timeout-minutes: 10
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_package_install_inference_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
timeout-minutes: 10
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_package_install_inference_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
timeout-minutes: 15
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
timeout-minutes: 30
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_package_install_inference_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
timeout-minutes: 10
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
timeout-minutes: 35
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests_inference_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
timeout-minutes: 10
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests_workflows_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
timeout-minutes: 10
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:
- name: 🛎️ Checkout
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .release/pypi/inference.cli.setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ def read_requirements(path):
"Typing :: Typed",
"Operating System :: OS Independent",
],
python_requires=">=3.8,<3.12",
python_requires=">=3.8,<3.13"
)
2 changes: 1 addition & 1 deletion .release/pypi/inference.core.setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ def read_requirements(path):
"Typing :: Typed",
"Operating System :: OS Independent",
],
python_requires=">=3.8,<3.12",
python_requires=">=3.8,<3.13"
)
2 changes: 1 addition & 1 deletion .release/pypi/inference.cpu.setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ def read_requirements(path):
"Typing :: Typed",
"Operating System :: OS Independent",
],
python_requires=">=3.8,<3.12",
python_requires=">=3.8,<3.13"
)
2 changes: 1 addition & 1 deletion .release/pypi/inference.gpu.setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ def read_requirements(path):
"Typing :: Typed",
"Operating System :: OS Independent",
],
python_requires=">=3.8,<3.12",
python_requires=">=3.8,<3.13"
)
2 changes: 1 addition & 1 deletion .release/pypi/inference.sdk.setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ def read_requirements(path):
"Typing :: Typed",
"Operating System :: OS Independent",
],
python_requires=">=3.8,<3.12",
python_requires=">=3.8,<3.13"
)
2 changes: 1 addition & 1 deletion .release/pypi/inference.setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ def read_requirements(path):
"Typing :: Typed",
"Operating System :: OS Independent",
],
python_requires=">=3.8,<3.12",
python_requires=">=3.8,<3.13"
)
13 changes: 7 additions & 6 deletions inference/core/devices/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ def is_running_in_docker():
def get_gpu_id():
"""Fetches the GPU ID if a GPU is present.

Tries to import and use the `GPUtil` module to retrieve the GPU information.
Tries to import and use the `pynvml` (delivered by nvidia-ml-py) module to retrieve the GPU information.

Returns:
Optional[int]: GPU ID if available, None otherwise.
"""
try:
import GPUtil
from pynvml import nvmlDeviceGetCount, nvmlInit

GPUs = GPUtil.getGPUs()
if GPUs:
return GPUs[0].id
nvmlInit()
gpus_count = nvmlDeviceGetCount()
if gpus_count:
return 0
except ImportError:
return None
except Exception as e:
except Exception:
return None


Expand Down
17 changes: 14 additions & 3 deletions inference_cli/lib/benchmark/platform.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
from cpuinfo import get_cpu_info
from GPUtil import GPUtil
from pynvml import nvmlInit, nvmlDeviceGetCount, nvmlDeviceGetHandleByIndex, nvmlDeviceGetName


def retrieve_platform_specifics() -> dict:
gpus_count = 0
gpu_names = []
try:
nvmlInit()
grzegorz-roboflow marked this conversation as resolved.
Show resolved Hide resolved
gpus_count = nvmlDeviceGetCount()
for i in range(gpus_count):
handle = nvmlDeviceGetHandleByIndex(i)
gpu_name = nvmlDeviceGetName(handle)
gpu_names.append(gpu_name)
except Exception:
# No GPUs
pass

cpu_info = get_cpu_info()
gpus = GPUtil.getGPUs()
gpu_names = list({gpu.name for gpu in gpus})
return {
"python_version": cpu_info["python_version"],
"architecture": cpu_info["arch_string_raw"],
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.cli.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PyYAML~=6.0.0
supervision>=0.21.0,<=0.22.0
opencv-python>=4.8.1.78,<=4.10.0.84
tqdm>=4.0.0,<5.0.0
GPUtil~=1.4.0
nvidia-ml-py<13.0.0
py-cpuinfo~=9.0.0
aiohttp>=3.9.0,<=3.10.11
backoff~=2.2.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.cpu.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
onnxruntime>=1.15.1,<1.20.0
GPUtil==1.4.0
nvidia-ml-py<13.0.0
Loading