@@ -447,7 +447,7 @@ def get_platform():
447
447
'system' : platform .system (),
448
448
'release' : release ,
449
449
'python' : platform .python_version (),
450
- 'docker' : os .environ .get ('SD_INSTALL_DEBUG ' , None ) is not None ,
450
+ 'docker' : os .environ .get ('SD_DOCKER ' , None ) is not None ,
451
451
# 'host': platform.node(),
452
452
# 'version': platform.version(),
453
453
}
@@ -492,7 +492,7 @@ def check_diffusers():
492
492
t_start = time .time ()
493
493
if args .skip_all or args .skip_git :
494
494
return
495
- sha = 'b785ddb654e4be3ae0066e231734754bdb2a191c ' # diffusers commit hash
495
+ sha = '7b100ce589b917d4c116c9e61a6ec46d4f2ab062 ' # diffusers commit hash
496
496
pkg = pkg_resources .working_set .by_key .get ('diffusers' , None )
497
497
minor = int (pkg .version .split ('.' )[1 ] if pkg is not None else 0 )
498
498
cur = opts .get ('diffusers_version' , '' ) if minor > 0 else ''
@@ -625,6 +625,9 @@ def install_rocm_zluda():
625
625
else :
626
626
torch_command = os .environ .get ('TORCH_COMMAND' , f'torch torchvision --index-url https://download.pytorch.org/whl/rocm{ rocm .version } ' )
627
627
628
+ if os .environ .get ('TRITON_COMMAND' , None ) is None :
629
+ os .environ .setdefault ('TRITON_COMMAND' , 'skip' ) # pytorch auto installs pytorch-triton-rocm as a dependency instead
630
+
628
631
if sys .version_info < (3 , 11 ):
629
632
ort_version = os .environ .get ('ONNXRUNTIME_VERSION' , None )
630
633
if rocm .version is None or float (rocm .version ) > 6.0 :
@@ -659,22 +662,39 @@ def install_rocm_zluda():
659
662
660
663
def install_ipex (torch_command ):
661
664
t_start = time .time ()
662
- check_python (supported_minors = [10 ,11 ], reason = 'IPEX backend requires Python 3.10 or 3.11' )
665
+ # Python 3.12 will cause compatibility issues with other dependencies
666
+ # IPEX supports Python 3.12 so don't block it but don't advertise it in the error message
667
+ check_python (supported_minors = [9 , 10 , 11 , 12 ], reason = 'IPEX backend requires Python 3.9, 3.10 or 3.11' )
663
668
args .use_ipex = True # pylint: disable=attribute-defined-outside-init
664
669
log .info ('IPEX: Intel OneAPI toolkit detected' )
670
+
665
671
if os .environ .get ("NEOReadDebugKeys" , None ) is None :
666
672
os .environ .setdefault ('NEOReadDebugKeys' , '1' )
667
673
if os .environ .get ("ClDeviceGlobalMemSizeAvailablePercent" , None ) is None :
668
674
os .environ .setdefault ('ClDeviceGlobalMemSizeAvailablePercent' , '100' )
675
+ if os .environ .get ("SYCL_CACHE_PERSISTENT" , None ) is None :
676
+ os .environ .setdefault ('SYCL_CACHE_PERSISTENT' , '1' ) # Jit cache
677
+
669
678
if os .environ .get ("PYTORCH_ENABLE_XPU_FALLBACK" , None ) is None :
670
- os .environ .setdefault ('PYTORCH_ENABLE_XPU_FALLBACK' , '1' )
679
+ os .environ .setdefault ('PYTORCH_ENABLE_XPU_FALLBACK' , '1' ) # CPU fallback for unsupported ops
680
+ if os .environ .get ("OverrideDefaultFP64Settings" , None ) is None :
681
+ os .environ .setdefault ('OverrideDefaultFP64Settings' , '1' )
682
+ if os .environ .get ("IGC_EnableDPEmulation" , None ) is None :
683
+ os .environ .setdefault ('IGC_EnableDPEmulation' , '1' ) # FP64 Emulation
684
+ if os .environ .get ('IPEX_FORCE_ATTENTION_SLICE' , None ) is None :
685
+ # XPU PyTorch doesn't support Flash Atten or Memory Atten yet so Battlemage goes OOM without this
686
+ os .environ .setdefault ('IPEX_FORCE_ATTENTION_SLICE' , '1' )
687
+
671
688
if "linux" in sys .platform :
672
- torch_command = os .environ .get ('TORCH_COMMAND' , 'torch==2.5.1+cxx11.abi torchvision==0.20.1+cxx11.abi intel-extension-for-pytorch==2.5.10+xpu oneccl_bind_pt==2.5.0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/' )
673
- # torch_command = os.environ.get('TORCH_COMMAND', 'torch torchvision --index-url https://download.pytorch.org/whl/test/xpu') # test wheels are stable previews, significantly slower than IPEX
674
- # os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.15.1 intel-extension-for-tensorflow[xpu]==2.15.0.1')
689
+ # default to US server. If The China server is needed, change .../release-whl/stable/xpu/us/ to .../release-whl/stable/xpu/cn/
690
+ torch_command = os .environ .get ('TORCH_COMMAND' , 'torch==2.5.1+cxx11.abi torchvision==0.20.1+cxx11.abi intel-extension-for-pytorch==2.5.10+xpu oneccl_bind_pt==2.5.0+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/' )
691
+ if os .environ .get ('TRITON_COMMAND' , None ) is None :
692
+ os .environ .setdefault ('TRITON_COMMAND' , '--pre pytorch-triton-xpu==3.1.0+91b14bf559 --index-url https://download.pytorch.org/whl/nightly/xpu' )
693
+ # os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.15.1 intel-extension-for-tensorflow[xpu]==2.15.0.2')
675
694
else :
676
- torch_command = os .environ .get ('TORCH_COMMAND' , '--pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/xpu' ) # torchvision doesn't exist on test/stable branch for windows
677
- install (os .environ .get ('OPENVINO_PACKAGE' , 'openvino==2024.5.0' ), 'openvino' , ignore = True )
695
+ torch_command = os .environ .get ('TORCH_COMMAND' , 'torch==2.6.0+xpu torchvision==0.21.0+xpu --index-url https://download.pytorch.org/whl/test/xpu' )
696
+
697
+ install (os .environ .get ('OPENVINO_PACKAGE' , 'openvino==2024.6.0' ), 'openvino' , ignore = True )
678
698
install ('nncf==2.7.0' , ignore = True , no_deps = True ) # requires older pandas
679
699
install (os .environ .get ('ONNXRUNTIME_PACKAGE' , 'onnxruntime-openvino' ), 'onnxruntime-openvino' , ignore = True )
680
700
ts ('ipex' , t_start )
@@ -683,6 +703,8 @@ def install_ipex(torch_command):
683
703
684
704
def install_openvino (torch_command ):
685
705
t_start = time .time ()
706
+ # Python 3.12 will cause compatibility issues with other dependencies.
707
+ # OpenVINO supports Python 3.12 so don't block it but don't advertise it in the error message
686
708
check_python (supported_minors = [9 , 10 , 11 , 12 ], reason = 'OpenVINO backend requires Python 3.9, 3.10 or 3.11' )
687
709
log .info ('OpenVINO: selected' )
688
710
if sys .platform == 'darwin' :
@@ -726,11 +748,22 @@ def install_torch_addons():
726
748
install ('optimum-quanto==0.2.6' , 'optimum-quanto' )
727
749
if not args .experimental :
728
750
uninstall ('wandb' , quiet = True )
729
- if triton_command is not None :
751
+ if triton_command is not None and triton_command != 'skip' :
730
752
install (triton_command , 'triton' , quiet = True )
731
753
ts ('addons' , t_start )
732
754
733
755
756
+ # check cudnn
757
+ def check_cudnn ():
758
+ import site
759
+ site_packages = site .getsitepackages ()
760
+ cuda_path = os .environ .get ('CUDA_PATH' , '' )
761
+ for site_package in site_packages :
762
+ folder = os .path .join (site_package , 'nvidia' , 'cudnn' , 'lib' )
763
+ if os .path .exists (folder ) and folder not in cuda_path :
764
+ os .environ ['CUDA_PATH' ] = f"{ cuda_path } :{ folder } "
765
+
766
+
734
767
# check torch version
735
768
def check_torch ():
736
769
t_start = time .time ()
@@ -842,6 +875,7 @@ def check_torch():
842
875
return
843
876
if not args .skip_all :
844
877
install_torch_addons ()
878
+ check_cudnn ()
845
879
if args .profile :
846
880
pr .disable ()
847
881
print_profile (pr , 'Torch' )
@@ -1056,7 +1090,7 @@ def install_optional():
1056
1090
install ('gfpgan' )
1057
1091
install ('clean-fid' )
1058
1092
install ('pillow-jxl-plugin==1.3.1' , ignore = True )
1059
- install ('optimum-quanto=0.2.6' , ignore = True )
1093
+ install ('optimum-quanto== 0.2.6' , ignore = True )
1060
1094
install ('bitsandbytes==0.45.0' , ignore = True )
1061
1095
install ('pynvml' , ignore = True )
1062
1096
install ('ultralytics==8.3.40' , ignore = True )
0 commit comments