mirror of
https://github.com/huggingface/accelerate.git
synced 2025-10-20 18:13:46 +08:00
Bump to python3.10 + update linter (#3809)
* py310 and some changes * fix * better
This commit is contained in:
4
.github/workflows/integration_tests.yml
vendored
4
.github/workflows/integration_tests.yml
vendored
@ -27,10 +27,10 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up python 3.9
|
- name: Set up python 3.10
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: '3.10'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: 'setup.py'
|
cache-dependency-path: 'setup.py'
|
||||||
|
|
||||||
|
4
.github/workflows/quality.yml
vendored
4
.github/workflows/quality.yml
vendored
@ -7,10 +7,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python 3.9
|
- name: Set up Python 3.10
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: '3.10'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: 'setup.py'
|
cache-dependency-path: 'setup.py'
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
|
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: '3.10'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: 'setup.py'
|
cache-dependency-path: 'setup.py'
|
||||||
|
|
||||||
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -39,10 +39,10 @@ jobs:
|
|||||||
]
|
]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up python 3.9
|
- name: Set up python 3.10
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: '3.10'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: 'setup.py'
|
cache-dependency-path: 'setup.py'
|
||||||
|
|
||||||
|
4
.github/workflows/test_imports.yml
vendored
4
.github/workflows/test_imports.yml
vendored
@ -27,10 +27,10 @@ jobs:
|
|||||||
]
|
]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up python 3.9
|
- name: Set up python 3.10
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: '3.10'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
cache-dependency-path: 'setup.py'
|
cache-dependency-path: 'setup.py'
|
||||||
|
|
||||||
|
3
Makefile
3
Makefile
@ -8,19 +8,16 @@ extra_quality_checks:
|
|||||||
python utils/check_copies.py
|
python utils/check_copies.py
|
||||||
python utils/check_dummies.py
|
python utils/check_dummies.py
|
||||||
python utils/check_repo.py
|
python utils/check_repo.py
|
||||||
doc-builder style src/accelerate docs/source --max_len 119
|
|
||||||
|
|
||||||
# this target runs checks on all files
|
# this target runs checks on all files
|
||||||
quality:
|
quality:
|
||||||
ruff check $(check_dirs)
|
ruff check $(check_dirs)
|
||||||
ruff format --check $(check_dirs)
|
ruff format --check $(check_dirs)
|
||||||
doc-builder style src/accelerate docs/source --max_len 119 --check_only
|
|
||||||
|
|
||||||
# Format source code automatically and check is there are any problems left that need manual fixing
|
# Format source code automatically and check is there are any problems left that need manual fixing
|
||||||
style:
|
style:
|
||||||
ruff check $(check_dirs) --fix
|
ruff check $(check_dirs) --fix
|
||||||
ruff format $(check_dirs)
|
ruff format $(check_dirs)
|
||||||
doc-builder style src/accelerate docs/source --max_len 119
|
|
||||||
|
|
||||||
# Run tests for the library
|
# Run tests for the library
|
||||||
test_core:
|
test_core:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Builds CPU-only Docker image of PyTorch
|
# Builds CPU-only Docker image of PyTorch
|
||||||
# Uses multi-staged approach to reduce size
|
# Uses multi-staged approach to reduce size
|
||||||
# Stage 1
|
# Stage 1
|
||||||
FROM python:3.9-slim as compile-image
|
FROM python:3.10-slim as compile-image
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ RUN python3 -m pip install --no-cache-dir \
|
|||||||
--extra-index-url https://download.pytorch.org/whl/cpu
|
--extra-index-url https://download.pytorch.org/whl/cpu
|
||||||
|
|
||||||
# Stage 2
|
# Stage 2
|
||||||
FROM python:3.9-slim AS build-image
|
FROM python:3.10-slim AS build-image
|
||||||
COPY --from=compile-image /opt/venv /opt/venv
|
COPY --from=compile-image /opt/venv /opt/venv
|
||||||
RUN useradd -ms /bin/bash user
|
RUN useradd -ms /bin/bash user
|
||||||
USER user
|
USER user
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
# Use base conda image to reduce time
|
# Use base conda image to reduce time
|
||||||
FROM continuumio/miniconda3:latest AS compile-image
|
FROM continuumio/miniconda3:latest AS compile-image
|
||||||
# Specify py version
|
# Specify py version
|
||||||
# Note: DeepSpeed beyond v0.12.6 requires py 3.10
|
|
||||||
ENV PYTHON_VERSION=3.10
|
ENV PYTHON_VERSION=3.10
|
||||||
# Install apt libs
|
# Install apt libs
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# Use base conda image to reduce time
|
# Use base conda image to reduce time
|
||||||
FROM continuumio/miniconda3:latest AS compile-image
|
FROM continuumio/miniconda3:latest AS compile-image
|
||||||
# Specify py version
|
# Specify py version
|
||||||
ENV PYTHON_VERSION=3.9
|
ENV PYTHON_VERSION=3.10
|
||||||
# Install apt libs
|
# Install apt libs
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y curl git wget && \
|
apt-get install -y curl git wget && \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
line-length = 119
|
line-length = 119
|
||||||
target-version = "py39"
|
target-version = "py310"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
preview = true
|
preview = true
|
||||||
@ -20,6 +20,9 @@ ignore = [
|
|||||||
"E741", # Ambiguous variable name
|
"E741", # Ambiguous variable name
|
||||||
"W605", # Invalid escape sequence
|
"W605", # Invalid escape sequence
|
||||||
"UP007", # X | Y type annotations
|
"UP007", # X | Y type annotations
|
||||||
|
"UP045", # Use `X | None` for type annotations
|
||||||
|
"UP035", # temporarily disabled to minimize upgrade changes
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
[tool.ruff.lint.per-file-ignores]
|
||||||
|
15
setup.py
15
setup.py
@ -16,13 +16,10 @@ from setuptools import find_packages, setup
|
|||||||
|
|
||||||
|
|
||||||
extras = {}
|
extras = {}
|
||||||
extras["quality"] = [
|
extras["quality"] = ["ruff == 0.13.1"]
|
||||||
"black ~= 23.1", # hf-doc-builder has a hidden dependency on `black`
|
|
||||||
"hf-doc-builder >= 0.3.0",
|
|
||||||
"ruff ~= 0.11.2",
|
|
||||||
]
|
|
||||||
extras["docs"] = []
|
extras["docs"] = []
|
||||||
extras["test_prod"] = ["pytest>=7.2.0,<=8.0.0", "pytest-xdist", "pytest-subtests", "parameterized", "pytest-order"]
|
extras["test_prod"] = ["pytest>=7.2.0", "pytest-xdist", "pytest-subtests", "parameterized", "pytest-order"]
|
||||||
extras["test_dev"] = [
|
extras["test_dev"] = [
|
||||||
"datasets",
|
"datasets",
|
||||||
"diffusers",
|
"diffusers",
|
||||||
@ -79,9 +76,9 @@ setup(
|
|||||||
"accelerate-merge-weights=accelerate.commands.merge:main",
|
"accelerate-merge-weights=accelerate.commands.merge:main",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
python_requires=">=3.9.0",
|
python_requires=">=3.10.0",
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"numpy>=1.17,<3.0.0",
|
"numpy>=1.17",
|
||||||
"packaging>=20.0",
|
"packaging>=20.0",
|
||||||
"psutil",
|
"psutil",
|
||||||
"pyyaml",
|
"pyyaml",
|
||||||
@ -98,7 +95,7 @@ setup(
|
|||||||
"License :: OSI Approved :: Apache Software License",
|
"License :: OSI Approved :: Apache Software License",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user