add directml python version check

This commit is contained in:
Vladimir Mandic
2024-06-05 17:24:22 -04:00
parent 900264a194
commit 45d1cddbce
6 changed files with 22 additions and 19 deletions
+1
View File
@@ -40,6 +40,7 @@
thanks @lbeltrame
- lower overhead on generate calls
- cumulative fixes since the last release
- add python version check for torch-directml
## Update for 2024-06-02
+4 -2
View File
@@ -386,13 +386,14 @@ def get_platform():
# check python version
def check_python():
supported_minors = [9, 10, 11]
def check_python(supported_minors=[9, 10, 11], reason=None):
if args.quick:
return
log.info(f'Python {platform.python_version()} on {platform.system()}')
if not (int(sys.version_info.major) == 3 and int(sys.version_info.minor) in supported_minors):
log.error(f"Incompatible Python version: {sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} required 3.{supported_minors}")
if reason is not None:
log.error(reason)
if not args.ignore:
sys.exit(1)
if not args.skip_git:
@@ -619,6 +620,7 @@ def check_torch():
torch_command = os.environ.get('TORCH_COMMAND', 'torch torchvision')
elif allow_directml and args.use_directml and ('arm' not in machine and 'aarch' not in machine):
log.info('Using DirectML Backend')
check_python(supported_minors=[10], reason='DirectML backend requires Python 3.10')
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.0.0 torchvision torch-directml')
if 'torch' in torch_command and not args.version:
install(torch_command, 'torch torchvision')
+4 -1
View File
@@ -9,9 +9,12 @@ from typing import Optional, Tuple, Union
from diffusers import AutoencoderKL
from diffusers.configuration_utils import ConfigMixin, register_to_config
from diffusers.models.modeling_utils import ModelMixin
from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
from diffusers.models.autoencoders.vae import DecoderOutput
from diffusers.models.attention_processor import Attention, AttnProcessor
try:
from diffusers.models.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
except Exception:
from diffusers.models.unets.unet_2d_blocks import UNetMidBlock2D, get_down_block, get_up_block
def zero_module(module):
+5 -7
View File
@@ -28,20 +28,18 @@ from diffusers.models.embeddings import (
ImageHintTimeEmbedding,
ImageProjection,
ImageTimeEmbedding,
PositionNet,
TextImageProjection,
TextImageTimeEmbedding,
TextTimeEmbedding,
TimestepEmbedding,
Timesteps,
)
from modules.xadapter.xadapter_hijacks import PositionNet
from diffusers.models.modeling_utils import ModelMixin
from diffusers.models.unet_2d_blocks import (
UNetMidBlock2DCrossAttn,
UNetMidBlock2DSimpleCrossAttn,
get_down_block,
get_up_block,
)
try:
from diffusers.models.unet_2d_blocks import UNetMidBlock2DCrossAttn, UNetMidBlock2DSimpleCrossAttn, get_down_block, get_up_block
except Exception:
from diffusers.models.unets.unet_2d_blocks import UNetMidBlock2DCrossAttn, UNetMidBlock2DSimpleCrossAttn, get_down_block, get_up_block
logger = logging.get_logger(__name__) # pylint: disable=invalid-name
+7 -8
View File
@@ -3,7 +3,6 @@ patch-ng
anyio
addict
astunparse
blendmodes
clean-fid
filetype
future
@@ -15,32 +14,27 @@ kornia
lark
lpips
omegaconf
open-clip-torch
optimum
piexif
psutil
pyyaml
resize-right
rich
scipy
toml
torchdiffeq
voluptuous
yapf
scikit-image
fasteners
dctorch
pymatting
orjson
invisible-watermark
pi-heif
diffusers==0.28.0
diffusers==0.28.1
safetensors==0.4.3
tensordict==0.1.2
peft==0.11.1
httpx==0.24.1
compel==2.0.2
torchsde==0.2.6
open-clip-torch
clip-interrogator==0.6.0
antlr4-python3-runtime==4.9.3
requests==2.31.0
@@ -53,6 +47,8 @@ huggingface_hub==0.23.2
numexpr==2.8.8
numpy==1.26.4
numba==0.59.1
blendmodes
scipy
pandas
protobuf==4.25.3
pytorch_lightning==1.9.4
@@ -63,3 +59,6 @@ Pillow==10.3.0
timm==0.9.16
pydantic==1.10.15
typing-extensions==4.11.0
torchdiffeq
dctorch
scikit-image