Freitag, 2. August 2024

Apache Server Lokal installieren

Schritt 1: Apache HTTP Server installieren

  1. Öffne das Terminal.

  2. Führe folgenden Befehl aus, um Apache zu installieren:

    sudo apt install apache2


    Schritt 2: Apache für den lokalen Zugriff konfigurieren

    sudo nano /etc/apache2/ports.conf 

    Listen 80 →  Listen 127.0.0.1:80

    sudo nano /etc/apache2/sites-available/000-default.conf 

     <VirtualHost *:80> → <VirtualHost 127.0.0.1:80>

    Anpassen des Dokumentenstamms (Optional) 

     sudo nano /etc/apache2/sites-available/000-default.conf
     
    DocumentRoot /home/username/public_html
    sudo mkdir -p /home/username/public_html 
    sudo systemctl restart apache2 

    Schritt 3: Benutzerverzeichnis-Modul aktivieren 

    sudo a2enmod userdir 

    Nur public_html zugänglich machen (dieser Teil ist nicht getestet)

    1. Setze die Berechtigungen für das Home-Verzeichnis auf 750:

      • Dies stellt sicher, dass nur du und die Gruppe Zugriff auf dein Home-Verzeichnis haben.
      chmod 750 /home/user
      sudo groupadd webaccess sudo usermod -a -G webaccess user sudo usermod -a -G webaccess www-data 
      sudo chown -R user:webaccess /home/user/public_html sudo chmod 750 /home/user/public_html 

     

     Schritt

    sudo systemctl restart apache2 

Freitag, 7. Juni 2024

Stable Diffusion mit Radeon 7600 XT zum Laufen bringen

(was funktioniert hat:  ein modifiziertes Repo. Ich glaube, es war https://github.com/lshqqytiger/stable-diffusion-webui-amdgpu. Oder https://community.amd.com/t5/ai/how-to-automatic1111-stable-diffusion-webui-with-directml/ba-p/649027 ? Ich weiß es nicht mehr.)

 

 Achtung: Diese Anleitung funktioniert bei mir NICHT!


Nach jeder korrigierten Fehlermeldung kommt eine neue. Oder zwei.

 Diese Anleitung fußt auf die offizielle Anleitung von AMD und Automatic1111.  

Ich mach das auf Ubuntu 22.04. 

Erstmal Docker installieren:

Prerequisites to install PyTorch using Docker

Docker for Ubuntu® must be installed.

To install Docker for Ubuntu, enter the following command:

sudo apt install docker.io

Use Docker image with pre-installed PyTorch

Follow these steps for installing using a Docker image.

  1. Enter the following command to pull the public PyTorch Docker image.

    sudo docker pull rocm/pytorch:rocm6.0.2_ubuntu22.04_py3.10_pytorch_2.1.2
    
  • Optional: You can also download a specific and supported configuration with different user-space ROCm versions, PyTorch versions, and supported operating systems.

    Refer to hub.docker.com/r/rocm/pytorch to download the PyTorch Docker image.

  • Start a Docker container using the downloaded image.

    sudo docker run -it \
      --cap-add=SYS_PTRACE \
      --security-opt seccomp=unconfined \
      --device=/dev/kfd \
      --device=/dev/dri \
      --group-add video \
      --ipc=host \
      --shm-size 8G \
    -e HIP_VISIBLE_DEVICES=0 \ -e HSA_ENABLE_SDMA=0 \ -e HIP_LAUNCH_BLOCKING=1 \
    -v $HOME/dockerx:/dockerx \
    rocm/pytorch:rocm6.0.2_ubuntu22.04_py3.10_pytorch_2.1.
  • Next, verify your PyTorch installation.

    See PyTorch Installation for ROCm for more information.

     

    So, jetzt noch automatic1111 installieren: 

    cd /dockerx
    git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
    cd stable-diffusion-webui
    python -m pip install --upgrade pip wheel
    
    # It's possible that you don't need "--precision full", dropping "--no-half" however crashes my drivers
    REQS_FILE='requirements.txt' python launch.py --precision full --no-half

    Problembehandlung

     ModuleNotFoundError: No module named 'pytorch_lightning.utilities.distributed'

    Das konnte ich umgehen, indem ich eine ältere Version von pytorch_lightning installiert habe: 
    pip install pytorch-lightning==1.6.5

    ModuleNotFoundError: No module named 'timm'

    pip install timm

    RuntimeError: HIP error: shared object initialization failed

    HIP kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing HIP_LAUNCH_BLOCKING=1. Compile with `TORCH_USE_HIP_DSA` to enable device-side assertions.
     
    Um diesen Fehler zu umgehen, habe ich oben im Aufruf von Docker
    -e HIP_VISIBLE_DEVICES=0 \
    -e HSA_ENABLE_SDMA=0 \
    -e HIP_LAUNCH_BLOCKING=1 \
    eingefügt.

     Rust und Cargo fehlt

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    export PATH="/root/.cargo/bin:${PATH}"
    rustc --version
    (testet, ob Rust installiert ist)

    error: failed to run custom build command for `openssl-sys v0.9.102`

    apt update
    apt install libssl-dev pkg-config
    export PATH="/root/.cargo/bin:${PATH}"

    ERROR: Failed building wheel for tokenizers ERROR: Could not build wheels for pillow-avif-plugin, kornia-rs, tokenizers which use PEP 517 and cannot be installed directly

    und: No CMAKE_ASM_NASM_COMPILER could be found.

    Abhängigkeiten installieren:

    apt-get update && apt-get install -y --no-install-recommends     rocm-dev hip-runtime-amd     curl     build-essential     libssl-dev     pkg-config     libjpeg-dev nsmd cmake openssl    zlib1g-dev     libpng-dev     libavif-dev     && rm -rf /var/lib/apt/lists/*
    pip install tokenizers
    pip install kornia-rs
    pip install pillow-avif-plugin

    Problem mit dem Kompilieren von Tokenizer

    RUSTUP_TOOLCHAIN=1.72.0 pip install tokenizers==0.13.2