diff --git a/examples/boft_controlnet/utils/pipeline_controlnet.py b/examples/boft_controlnet/utils/pipeline_controlnet.py index d4f5f35ed8..a6a69520af 100644 --- a/examples/boft_controlnet/utils/pipeline_controlnet.py +++ b/examples/boft_controlnet/utils/pipeline_controlnet.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from collections.abc import Callable from dataclasses import dataclass -from typing import Any, Callable, Optional, Union +from typing import Any, Optional, Union import numpy as np import PIL.Image diff --git a/pyproject.toml b/pyproject.toml index 76c7294107..1e8d3ebfd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,10 @@ [tool.black] # Only used by `hf-doc-builder“. line-length = 119 -target-version = ['py38'] +target-version = ['py310'] [tool.ruff] -target-version = "py39" +target-version = "py310" line-length = 119 extend-exclude = ["*.ipynb"] diff --git a/src/peft/optimizers/lorafa.py b/src/peft/optimizers/lorafa.py index 61e331ed10..4d3d648435 100644 --- a/src/peft/optimizers/lorafa.py +++ b/src/peft/optimizers/lorafa.py @@ -19,8 +19,7 @@ from __future__ import annotations import math -from collections.abc import Iterable -from typing import Callable +from collections.abc import Callable, Iterable import torch import torch.nn as nn diff --git a/src/peft/tuners/lora/corda.py b/src/peft/tuners/lora/corda.py index d9eba35eb8..32420487fc 100644 --- a/src/peft/tuners/lora/corda.py +++ b/src/peft/tuners/lora/corda.py @@ -16,8 +16,8 @@ # Reference paper: https://huggingface.co/papers/2406.05223 import os -from collections.abc import Iterable -from typing import Any, Callable, Optional +from collections.abc import Callable, Iterable +from typing import Any, Optional import torch import torch.nn as nn diff --git a/src/peft/tuners/waveft/waverec2d.py b/src/peft/tuners/waveft/waverec2d.py index e05f5dc547..907049787a 100644 --- a/src/peft/tuners/waveft/waverec2d.py +++ b/src/peft/tuners/waveft/waverec2d.py @@ -11,11 +11,11 @@ from collections.abc import Callable, Sequence from functools import partial -from typing import Any, NamedTuple, Protocol, Union, cast, overload +from typing import Any, NamedTuple, Protocol, TypeAlias, Union, cast, overload import numpy as np import torch -from typing_extensions import TypeAlias, Unpack +from typing_extensions import Unpack from .wavelet import Wavelet as minimal_wavelet diff --git a/src/peft/tuners/xlora/layer.py b/src/peft/tuners/xlora/layer.py index d9fabd75b2..c3be6bcb5c 100644 --- a/src/peft/tuners/xlora/layer.py +++ b/src/peft/tuners/xlora/layer.py @@ -13,7 +13,8 @@ # limitations under the License. from __future__ import annotations -from typing import Any, Callable, Optional +from collections.abc import Callable +from typing import Any, Optional import torch import torch.nn as nn diff --git a/src/peft/utils/loftq_utils.py b/src/peft/utils/loftq_utils.py index a5b19b4467..ce502e167b 100644 --- a/src/peft/utils/loftq_utils.py +++ b/src/peft/utils/loftq_utils.py @@ -19,7 +19,8 @@ import logging import os -from typing import Callable, Optional, Union +from collections.abc import Callable +from typing import Optional, Union import torch from accelerate.utils.memory import clear_device_cache