Rehber Intel ARC ekran kartları ile Stable Diffusion WebUI kurulumu

SoteMix




Notlar:

Veri Tipleri (Data Type):

BF16 genel olarak FP16'dan daha hızlı.

Backend:​

Diffusers Backend, Original Backend'e %10-%25 daha hızlı.

Linux üzerinde ipexrun hataları:

Eğer başlangıçta rastgele hatalar alıyorsanız büyük ihtimalle ipexrun kaynaklıdır.
Ipexrun'ı devre dışı bırakmak için DISABLE_IPEXRUN=1 export edin.


iGPU hataları:

UHD veya Iris Xe gibi iGPU'nuz varsa Aygıt Yöneticisi'nden devre dışı bırakn.


Windows Kurulumu
Hazırlıklar:
  • Intel GPU Sürücüsü indirip kurun.
  • Git indirip kurun.
  • Python 3.10 veya 3.11 indirip kurun.
  • SD.Next'i kurmak istediğiniz klasörde CMD açın.
SD.Next Kullanımı:
Github'dan SD.Next'i indirelim:
Bash:
git clone https://github.com/vladmandic/automatic

Daha sonra SD.Next'in bulunduğu klasöre girelim:
Bash:
cd automatic

Daha sonra aşağıdaki komut ile SD.Next'i çalıştırabilirsiniz:
Bash:
.\webui.bat --use-ipex
Not: İlk başlatmada internetten gerekli kütüphaneleri indirdiğinden biraz zaman alacaktır.






Linux ve WSL Kurulumu
Intel OneAPI ve Compute Runtime Kurulumu:

Ubuntu:
Linux 6.2 kernelinden daha yeni bir kernele ihtiyacımız olduğundan en düşük Ubuntu 23.04 versiyonunu kullanmamız gerek.
Daha eski bir Ubuntu versiyonu kullanıyorsanız kernelinizi Linux 6.2 veya daha yeni bir versiyona güncellemeniz gerek.
Not: WSL için kernel güncellemek gerekli değil.


Daha sonra gerekli paket listesini sisteme ekleyelim:
Bash:
sudo apt update && sudo apt install -y ca-certificates wget gpg
Bash:
wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg
Bash:
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list
Bash:
sudo apt update && sudo apt upgrade -y

Daha sonra gerekli paketleri kuralım:
Bash:
sudo apt install intel-opencl-icd intel-level-zero-gpu level-zero git python3-pip python3-venv libgl1 libglib2.0-0 libgomp1 libjemalloc-dev


Arch Linux:
Arch Linux için gerekli paketleri kuralım:
Bash:
pacman -S intel-compute-runtime level-zero-headers level-zero-loader git python-pip python-virtualenv jemalloc



SD.Next Kullanımı:
Github'dan SD.Next'i indirelim:
Bash:
git clone https://github.com/vladmandic/automatic

Daha sonra SD.Next'in bulunduğu klasöre girelim:
Bash:
cd automatic

Daha sonra aşağıdaki komut ile SD.Next'i çalıştırabilirsiniz:
Bash:
./webui.sh --use-ipex
Not: İlk başlatmada internetten gerekli kütüphaneleri indirdiğinden biraz zaman alacaktır.
 
Son düzenleme:
@38life
Cuda hatasını nerede alıyorsunuz?
Normal kullanımda istesem de Cuda hatası alamıyorum.

Ek olarak Dreambooth'u daha test etmedim.
 
Son düzenleme:
@38life
Cuda hatasını nerede alıyorsunuz?
Normal kullanımda istesem de Cuda hatası alamıyorum.

Ek olarak Dreambooth'u daha test etmedim.

Başladığı yerin öncesinden sonuna kadar kopyaladım o kısmı. Buyur:


Kod:
Loading weights: /home/hayyam/Desktop/automatic/models/Stable-diffusion/v1-5-p…
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
12:19:25-758884 INFO     Model created from config:                             
                         /home/hayyam/Desktop/automatic/configs/v1-inference.yam
                         l                                                     
12:19:34-476580 INFO     Applying sub-quadratic cross attention optimization   
12:19:34-621185 INFO     Applied IPEX Optimize                                 
12:19:34-778900 INFO     Embeddings loaded: 0 []                               
12:19:34-783809 INFO     Model loaded in 10.4s (load=1.1s create=0.3s apply=7.7s
                         vae=0.3s move=0.8s embeddings=0.3s)                   
12:19:34-984031 INFO     Model load finished: {'ram': {'used': 8.01, 'total':   
                         31.26}, 'gpu': {'used': 2.02, 'total': 15.11},         
                         'retries': 0, 'oom': 0}                               
12:19:35-276959 INFO     Loading UI theme: name=black-orange style=Auto         
12:19:35-278688 ERROR    executing callback:                                   
                         /home/hayyam/Desktop/automatic/extensions-builtin/a1111
                         -sd-webui-lycoris/scripts/lycoris_script.py before_ui:
                         AttributeError                                         
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/hayyam/Desktop/automatic/modules/script_callbacks.py:257 in            │
│ before_ui_callback                                                           │
│                                                                              │
│   256 │   │   try:                                                           │
│ ❱ 257 │   │   │   c.callback()                                               │
│   258 │   │   except Exception as e:                                         │
│                                                                              │
│ /home/hayyam/Desktop/automatic/extensions-builtin/a1111-sd-webui-lycoris/scr │
│ ipts/lycoris_script.py:20 in before_ui                                       │
│                                                                              │
│   19 def before_ui():                                                        │
│ ❱ 20 │   if shared.cmd_opts.lyco_patch_lora:                                 │
│   21 │   │   print(                                                          │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Namespace' object has no attribute 'lyco_patch_lora'
Create LRU cache (max_size=16) for preprocessor results.
Create LRU cache (max_size=16) for preprocessor results.
12:19:35-685541 INFO     Available models:                                     
                         /home/hayyam/Desktop/automatic/models/Stable-diffusion
                         8                                                     
CUDA SETUP: Required library version not found: libsbitsandbytes_cpu.so. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes.so...

================================================ERROR=====================================
CUDA SETUP: CUDA detection failed! Possible reasons:
1. CUDA driver not installed
2. CUDA not installed
3. You have multiple conflicting CUDA libraries
4. Required library not pre-compiled for this bitsandbytes release!
CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.
================================================================================

CUDA SETUP: Problem: The main issue seems to be that the main CUDA library was not detected.
CUDA SETUP: Solution 1): Your paths are probably not up-to-date. You can update them via: sudo ldconfig.
CUDA SETUP: Solution 2): If you do not have sudo rights, you can do the following:
CUDA SETUP: Solution 2a): Find the cuda library via: find / -name libcuda.so 2>/dev/null
CUDA SETUP: Solution 2b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_2a
CUDA SETUP: Solution 2c): For a permanent solution add the export from 2b into your .bashrc file, located at ~/.bashrc
CUDA SETUP: Required library version not found: libsbitsandbytes_cpu.so. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes.so...

================================================ERROR=====================================
CUDA SETUP: CUDA detection failed! Possible reasons:
1. CUDA driver not installed
2. CUDA not installed
3. You have multiple conflicting CUDA libraries
4. Required library not pre-compiled for this bitsandbytes release!
CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.
================================================================================

CUDA SETUP: Problem: The main issue seems to be that the main CUDA library was not detected.
CUDA SETUP: Solution 1): Your paths are probably not up-to-date. You can update them via: sudo ldconfig.
CUDA SETUP: Solution 2): If you do not have sudo rights, you can do the following:
CUDA SETUP: Solution 2a): Find the cuda library via: find / -name libcuda.so 2>/dev/null
CUDA SETUP: Solution 2b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_2a
CUDA SETUP: Solution 2c): For a permanent solution add the export from 2b into your .bashrc file, located at ~/.bashrc
Running on local URL:  http://127.0.0.1:7860
 
Başladığı yerin öncesinden sonuna kadar kopyaladım o kısmı. Buyur:


Kod:
Loading weights: /home/hayyam/Desktop/automatic/models/Stable-diffusion/v1-5-p…
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
12:19:25-758884 INFO     Model created from config:                           
                         /home/hayyam/Desktop/automatic/configs/v1-inference.yam
                         l                                                   
12:19:34-476580 INFO     Applying sub-quadratic cross attention optimization 
12:19:34-621185 INFO     Applied IPEX Optimize                               
12:19:34-778900 INFO     Embeddings loaded: 0 []                             
12:19:34-783809 INFO     Model loaded in 10.4s (load=1.1s create=0.3s apply=7.7s
                         vae=0.3s move=0.8s embeddings=0.3s)                 
12:19:34-984031 INFO     Model load finished: {'ram': {'used': 8.01, 'total': 
                         31.26}, 'gpu': {'used': 2.02, 'total': 15.11},       
                         'retries': 0, 'oom': 0}                             
12:19:35-276959 INFO     Loading UI theme: name=black-orange style=Auto       
12:19:35-278688 ERROR    executing callback:                                 
                         /home/hayyam/Desktop/automatic/extensions-builtin/a1111
                         -sd-webui-lycoris/scripts/lycoris_script.py before_ui:
                         AttributeError                                       
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /home/hayyam/Desktop/automatic/modules/script_callbacks.py:257 in            │
│ before_ui_callback                                                           │
│                                                                              │
│   256 │   │   try:                                                           │
│ ❱ 257 │   │   │   c.callback()                                               │
│   258 │   │   except Exception as e:                                         │
│                                                                              │
│ /home/hayyam/Desktop/automatic/extensions-builtin/a1111-sd-webui-lycoris/scr │
│ ipts/lycoris_script.py:20 in before_ui                                       │
│                                                                              │
│   19 def before_ui():                                                        │
│ ❱ 20 │   if shared.cmd_opts.lyco_patch_lora:                                 │
│   21 │   │   print(                                                          │
╰──────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Namespace' object has no attribute 'lyco_patch_lora'
Create LRU cache (max_size=16) for preprocessor results.
Create LRU cache (max_size=16) for preprocessor results.
12:19:35-685541 INFO     Available models:                                   
                         /home/hayyam/Desktop/automatic/models/Stable-diffusion
                         8                                                   
CUDA SETUP: Required library version not found: libsbitsandbytes_cpu.so. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes.so...

================================================ERROR=====================================
CUDA SETUP: CUDA detection failed! Possible reasons:
1. CUDA driver not installed
2. CUDA not installed
3. You have multiple conflicting CUDA libraries
4. Required library not pre-compiled for this bitsandbytes release!
CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.
================================================================================

CUDA SETUP: Problem: The main issue seems to be that the main CUDA library was not detected.
CUDA SETUP: Solution 1): Your paths are probably not up-to-date. You can update them via: sudo ldconfig.
CUDA SETUP: Solution 2): If you do not have sudo rights, you can do the following:
CUDA SETUP: Solution 2a): Find the cuda library via: find / -name libcuda.so 2>/dev/null
CUDA SETUP: Solution 2b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_2a
CUDA SETUP: Solution 2c): For a permanent solution add the export from 2b into your .bashrc file, located at ~/.bashrc
CUDA SETUP: Required library version not found: libsbitsandbytes_cpu.so. Maybe you need to compile it from source?
CUDA SETUP: Defaulting to libbitsandbytes.so...

================================================ERROR=====================================
CUDA SETUP: CUDA detection failed! Possible reasons:
1. CUDA driver not installed
2. CUDA not installed
3. You have multiple conflicting CUDA libraries
4. Required library not pre-compiled for this bitsandbytes release!
CUDA SETUP: If you compiled from source, try again with `make CUDA_VERSION=DETECTED_CUDA_VERSION` for example, `make CUDA_VERSION=113`.
================================================================================

CUDA SETUP: Problem: The main issue seems to be that the main CUDA library was not detected.
CUDA SETUP: Solution 1): Your paths are probably not up-to-date. You can update them via: sudo ldconfig.
CUDA SETUP: Solution 2): If you do not have sudo rights, you can do the following:
CUDA SETUP: Solution 2a): Find the cuda library via: find / -name libcuda.so 2>/dev/null
CUDA SETUP: Solution 2b): Once the library is found add it to the LD_LIBRARY_PATH: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:FOUND_PATH_FROM_2a
CUDA SETUP: Solution 2c): For a permanent solution add the export from 2b into your .bashrc file, located at ~/.bashrc
Running on local URL:  http://127.0.0.1:7860


Cuda hatasını hala alamıyorum. Hangi eklentileri kullanıyorsunuz?

Ama bu hatayı ben de aldım:
Bu hata lyco_patch_lora ayarının WebUI'da olmadığından kaynaklı ve ikinci denemede gitmesi gerek. IPEX ile alakalı bir şey değil.

Kod:
14:51:26-917248 ERROR    executing callback: /home/disty/Apps/automatic/extensions-builtin/a1111-sd-webui-lycoris/scripts/lycoris_script.py before_ui:      
                         AttributeError                                                                                                                      
╭──────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────╮
│ /home/disty/Apps/automatic/modules/script_callbacks.py:257 in before_ui_callback                                                                           │
│                                                                                                                                                            │
│   256 │   │   try:                                                                                                                                         │
│ ❱ 257 │   │   │   c.callback()                                                                                                                             │
│   258 │   │   except Exception as e:                                                                                                                       │
│                                                                                                                                                            │
│ /home/disty/Apps/automatic/extensions-builtin/a1111-sd-webui-lycoris/scripts/lycoris_script.py:20 in before_ui                                             │
│                                                                                                                                                            │
│   19 def before_ui():                                                                                                                                      │
│ ❱ 20 │   if shared.cmd_opts.lyco_patch_lora:                                                                                                               │
│   21 │   │   print(                                                                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
AttributeError: 'Namespace' object has no attribute 'lyco_patch_lora'
 
CUDA hatasını hala alamıyorum. Hangi eklentileri kullanıyorsunuz?

Ama bu hatayı ben de aldım:
Bu hata lyco_patch_lora ayarının webuı'da olmadığından kaynaklı ve ikinci denemede gitmesi gerek. Ipex ile alakalı bir şey değil.

Varsayılan olarak gelenler dışında bir tek dreambooth yükledim. Zaten ilk kurduğumda bu hata gelmiyordu sonradan gelmeye başladı. Tam olarak Dreambooth'u kurduktan sonra mı gelmeye başladı onu hatırlayamıyorum maalesef. Bilsem ona dikkat ederdim.
Öteki hata son açtığımda çıkmadı evet.
CUDA dışında bir de şu hatayı alıyorum. En başlarda çıkıyor bu kodu çalıştırdıktan sonra.

Kod:
Launching ipexrun launch.py...
/home/hayyam/Desktop/automatic/venv/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:
 warn(f"Failed to load image Python extension: {e}")
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - WARNING - Neither TCMalloc nor JeMalloc is found in $CONDA_PREFIX/lib or $VIRTUAL_ENV/lib or /.local/lib/ or /usr/local/lib/ or /usr/local/lib64/ or /usr/lib or /usr/lib64 or /home/hayyam/.local/lib/ so the LD_PRELOAD environment variable will not be set. This may drop the performance.
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - INFO - OMP_NUM_THREADS=6
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - WARNING - Unable to find the iomp library file libiomp5.so in $CONDA_PREFIX/lib or $VIRTUAL_ENV/lib or /.local/lib/ or /usr/local/lib/ or /usr/local/lib64/ or /usr/lib or /usr/lib64 or /home/hayyam/.local/lib/ so the LD_PRELOAD environment variable will not be set.you can use 'conda install intel-openm' to install intel openMP.
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - INFO - numactl -C 0-5 -m 0 /home/hayyam/Desktop/automatic/venv/bin/python3 -u launch.py --use-ipex

Bunların hepsi zararsız mı? Eklenti falan diyor genel olarak ama bilemedim.
 
Son düzenleyen: Moderatör:
Varsayılan olarak gelenler dışında bir tek dreambooth yükledim. Zaten ilk kurduğumda bu hata gelmiyordu sonradan gelmeye başladı. Tam olarak Dreambooth'u kurduktan sonra mı gelmeye başladı onu hatırlayamıyorum maalesef. Bilsem ona dikkat ederdim.
Öteki hata son açtığımda çıkmadı evet.
CUDA dışında bir de şu hatayı alıyorum. En başlarda çıkıyor bu kodu çalıştırdıktan sonra.

Kod:
Launching ipexrun launch.py...
/home/hayyam/Desktop/automatic/venv/lib/python3.10/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension:
 warn(f"Failed to load image Python extension: {e}")
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - WARNING - Neither TCMalloc nor JeMalloc is found in $CONDA_PREFIX/lib or $VIRTUAL_ENV/lib or /.local/lib/ or /usr/local/lib/ or /usr/local/lib64/ or /usr/lib or /usr/lib64 or /home/hayyam/.local/lib/ so the LD_PRELOAD environment variable will not be set. This may drop the performance.
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - INFO - OMP_NUM_THREADS=6
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - WARNING - Unable to find the iomp library file libiomp5.so in $CONDA_PREFIX/lib or $VIRTUAL_ENV/lib or /.local/lib/ or /usr/local/lib/ or /usr/local/lib64/ or /usr/lib or /usr/lib64 or /home/hayyam/.local/lib/ so the LD_PRELOAD environment variable will not be set.you can use 'conda install intel-openm' to install intel openMP.
2023-06-03 14:50:30,555 - intel_extension_for_pytorch.cpu.launch - INFO - numactl -C 0-5 -m 0 /home/hayyam/Desktop/automatic/venv/bin/python3 -u launch.py --use-ipex

Bunların hepsi zararsız mı? Eklenti falan diyor genel olarak ama bilemedim.

CUDA hatası Dreambooth eklentisi yüzünden.
Kullandığınız Dreambooth eklentisi hem eski hem de sadece CUDA için çalışıyor.
Dreambooth için eklenti yerine Kohya SS kullanmalısınız ama Kohya SS için IPEX desteği var mı bilmiyorum.

2. uyarı ise hata değil ve tamamen zararsız.
 
CUDA hatası Dreambooth eklentisi yüzünden.
Kullandığınız Dreambooth eklentisi hem eski hem de sadece CUDA için çalışıyor.
Dreambooth için eklenti yerine Kohya SS kullanmalısınız ama Kohya SS için IPEX desteği var mı bilmiyorum.

2. uyarı ise hata değil ve tamamen zararsız.
Kohya SS'i ilk kez duyuyorum. Araştırıp tutorial seyrediyim biraz. Umarım ipex desteği vardır. Google Bard'a sordum var dedi ama çok da güven olmaz ona. :)

Bir şey daha sormak istiyorum. Diğer Sampling Metodlarını indirebilir miyim? DPM++ SDE Karras kullanmak istiyorum ama varsayılan olarak yok.
 
Son düzenleme:
Bir şey daha sormak istiyorum. Diğer Sampling Metodlarını indirebilir miyim? DPM++ SDE Karras kullanmak istiyorum ama varsayılan olarak yok.

Bunu rehbere ekleyecektim ama unuttum :)

Ayarlardan Samper parameters menüsünden istediğinizi veya benim önerim DPM++ 2M SDE Karras olanı etkinleştirin.

Daha sonra automatic klasöründe bu komutu çalıştırın ve SD WebUI'ı yeniden başlatın:
Bash:
cd repositories/k-diffusion && git remote add disty https://github.com/Disty0/k-diffusion && git pull disty master
Not: Kod bu PR'yi otomatik uygulamaya yarıyor: Add transform_last for BrownianTreeNoiseSampler by Disty0 · Pull Request #68 · crowsonkb/k-diffusion
 
Stable Diffusion şuanda Intel GPU'lar ile Windows'ta wsl gerektirmeden çalıştırılabiliyor. Şu repoda rehberi var. Fakat tabii ki bir çok şey eksik. Eklenti yükleme, ayarlar sekmesi vs. yok. Sadece temel özellikler kullanılabiliyor. Controlnet de kullanılabiliyor ekstradan. Şu repo'da rehberi var.


Bunun için ayrı bir konu açıyım mi diye düşündüm ama çok fazla insanı ilgilendirmeyeceği için buraya yazayım dedim. Farklı konuda olması gerekiyorsa taşıyabilirsiniz.
 
Kohya SS'i ilk kez duyuyorum. Araştırıp tutorial seyrediyim biraz. Umarım ipex desteği vardır. Google Bard'a sordum var dedi ama çok da güven olmaz ona. :)

 

Yeni konular

Geri
Yukarı