fix(qwentts): fix GPU detection race, make ROCm flash-attn build opt-in

Bu işleme şunda yer alıyor:
2026-09-12 21:50:42 +02:00
ebeveyn c93f50460a
işleme 64b586913d
2 değiştirilmiş dosya ile 12 ekleme ve 1 silme
+9
Dosyayı Görüntüle
@@ -13,10 +13,19 @@ case "$DEVICE" in
;;
esac
BUILD_FLASH_ATTN=false
if [ "$DEVICE" = "rocm" ]; then
read -r -p "Compilare anche flash-attn da sorgente? Richiede molto tempo (decine di minuti). [y/N] " reply
case "$reply" in
[yY]|[yY][eE][sS]) BUILD_FLASH_ATTN=true ;;
esac
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
podman build \
--build-arg DEVICE="$DEVICE" \
--build-arg BUILD_FLASH_ATTN="$BUILD_FLASH_ATTN" \
-t "localhost/qwentts:$DEVICE" \
-t localhost/qwentts:latest \
-f "$SCRIPT_DIR/qwentts.Containerfile" \
+3 -1
Dosyayı Görüntüle
@@ -6,6 +6,7 @@
### BUILD (rocm): ./build-container.sh rocm
### RUN: podman run --rm -p 8000:8000 -v /path/to/models:/app/models qwentts:latest
ARG DEVICE=cpu
ARG BUILD_FLASH_ATTN=false
ARG BASE_IMAGE_CPU=python:3.12-slim
ARG BASE_IMAGE_ROCM=docker.io/rocm/pytorch-nightly
@@ -14,6 +15,7 @@ FROM ${BASE_IMAGE_ROCM} AS base-rocm
FROM base-${DEVICE}
ARG DEVICE
ARG BUILD_FLASH_ATTN
USER root
EXPOSE 8000
@@ -38,7 +40,7 @@ RUN if [ "$DEVICE" = "cpu" ]; then \
RUN pip install --no-cache-dir qwen-tts fastapi uvicorn python-multipart
# Optional flash-attn for ROCm, built from source (PyPI wheel is CUDA-only); best-effort, skipped on failure
RUN if [ "$DEVICE" = "rocm" ]; then \
RUN if [ "$DEVICE" = "rocm" ] && [ "$BUILD_FLASH_ATTN" = "true" ]; then \
pip install --no-cache-dir ninja \
&& git clone --depth 1 https://github.com/Dao-AILab/flash-attention.git /tmp/flash-attention \
&& (cd /tmp/flash-attention && GPU_ARCHS="gfx1150;gfx1151" python setup.py install) \