mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
IPEX & OpenVINO 1024x1024 workaround
This commit is contained in:
+3
-3
@@ -423,9 +423,9 @@ def check_torch():
|
||||
torch_command = os.environ.get('TORCH_COMMAND', 'torch==2.0.1a0 torchvision==0.15.2a0 intel_extension_for_pytorch==2.0.110+xpu --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/')
|
||||
os.environ.setdefault('TENSORFLOW_PACKAGE', 'tensorflow==2.13.0 intel-extension-for-tensorflow[gpu]')
|
||||
else:
|
||||
pytorch_pip = 'https://github.com/Disty0/automatic/releases/download/ipex_with_aot_for_windows/torch-2.0.0a0+gite9ebda2-cp310-cp310-win_amd64.whl'
|
||||
torchvision_pip = 'https://github.com/Disty0/automatic/releases/download/ipex_with_aot_for_windows/torchvision-0.15.2a0+fa99a53-cp310-cp310-win_amd64.whl'
|
||||
ipex_pip = 'https://github.com/Disty0/automatic/releases/download/ipex_with_aot_for_windows/intel_extension_for_pytorch-2.0.110+git0f2597b-cp310-cp310-win_amd64.whl'
|
||||
pytorch_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/torch-2.0.0a0+gite9ebda2-cp310-cp310-win_amd64.whl'
|
||||
torchvision_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/torchvision-0.15.2a0+fa99a53-cp310-cp310-win_amd64.whl'
|
||||
ipex_pip = 'https://github.com/Nuullll/intel-extension-for-pytorch/releases/download/v2.0.110%2Bxpu-master%2Bdll-bundle/intel_extension_for_pytorch-2.0.110+gitc6ea20b-cp310-cp310-win_amd64.whl'
|
||||
torch_command = os.environ.get('TORCH_COMMAND', f'{pytorch_pip} {torchvision_pip} {ipex_pip}')
|
||||
elif allow_openvino and args.use_openvino:
|
||||
#Remove this after 2.1.0 releases
|
||||
|
||||
@@ -84,7 +84,7 @@ def scaled_dot_product_attention(query, key, value, attn_mask=None, dropout_p=0.
|
||||
block_size = batch_size_attention * slice_block_size
|
||||
|
||||
split_slice_size = batch_size_attention
|
||||
if block_size > 5:
|
||||
if block_size > 6:
|
||||
do_split = True
|
||||
#Find something divisible with the shape_one
|
||||
while (split_slice_size * slice_block_size) > 4:
|
||||
@@ -96,7 +96,7 @@ def scaled_dot_product_attention(query, key, value, attn_mask=None, dropout_p=0.
|
||||
do_split = False
|
||||
|
||||
split_2_slice_size = query_tokens
|
||||
if split_slice_size * slice_block_size > 5:
|
||||
if split_slice_size * slice_block_size > 6:
|
||||
slice_block_size2 = shape_one * split_slice_size * shape_four / 1024 / 1024 * block_multiply
|
||||
do_split_2 = True
|
||||
#Find something divisible with the batch_size_attention
|
||||
|
||||
@@ -119,6 +119,9 @@ class StableDiffusionProcessing:
|
||||
self.cfg_scale: float = cfg_scale
|
||||
self.image_cfg_scale = image_cfg_scale
|
||||
self.diffusers_guidance_rescale = diffusers_guidance_rescale
|
||||
if (devices.backend == "ipex" or shared.cmd_opts.use_openvino) and width == 1024 and height == 1024:
|
||||
width = 1080
|
||||
height = 1080
|
||||
self.width: int = width
|
||||
self.height: int = height
|
||||
self.full_quality: bool = full_quality
|
||||
@@ -937,6 +940,18 @@ class StableDiffusionProcessingTxt2Img(StableDiffusionProcessing):
|
||||
def __init__(self, enable_hr: bool = False, denoising_strength: float = 0.75, firstphase_width: int = 0, firstphase_height: int = 0, hr_scale: float = 2.0, hr_force: bool = False, hr_upscaler: str = None, hr_second_pass_steps: int = 0, hr_resize_x: int = 0, hr_resize_y: int = 0, refiner_steps: int = 5, refiner_start: float = 0, refiner_prompt: str = '', refiner_negative: str = '', **kwargs):
|
||||
|
||||
super().__init__(**kwargs)
|
||||
if devices.backend == "ipex" or shared.cmd_opts.use_openvino:
|
||||
width_curse = bool(hr_resize_x == 1024 and self.height * (hr_resize_x / self.width) == 1024)
|
||||
height_curse = bool(hr_resize_y == 1024 and self.width * (hr_resize_y / self.height) == 1024)
|
||||
if (width_curse != height_curse) or (height_curse and width_curse):
|
||||
if width_curse:
|
||||
hr_resize_x = 1080
|
||||
if height_curse:
|
||||
hr_resize_y = 1080
|
||||
if self.width * hr_scale == 1024 and self.height * hr_scale == 1024:
|
||||
hr_scale = 1080 / self.width
|
||||
if firstphase_width * hr_scale == 1024 and firstphase_height * hr_scale == 1024:
|
||||
hr_scale = 1080 / firstphase_width
|
||||
self.enable_hr = enable_hr
|
||||
self.denoising_strength = denoising_strength
|
||||
self.hr_scale = hr_scale
|
||||
|
||||
Reference in New Issue
Block a user