Skip to content

Commit 017469f

Browse files
authored
Enable qwen-image (#56)
1 parent 08c14a7 commit 017469f

File tree

5 files changed

+502
-0
lines changed

5 files changed

+502
-0
lines changed

visual-ai/Qwen-image/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Docker setup
2+
3+
Build docker image:
4+
5+
```bash
6+
bash build.sh
7+
```
8+
9+
Run docker image:
10+
11+
```bash
12+
export DOCKER_IMAGE=llm-scaler-visualai:qwen-image
13+
export CONTAINER_NAME=qwen-image
14+
export MODEL_DIR=<your_model_dir>
15+
sudo docker run -itd \
16+
--privileged \
17+
--net=host \
18+
--device=/dev/dri \
19+
-e no_proxy=localhost,127.0.0.1 \
20+
--name=$CONTAINER_NAME \
21+
-v $MODEL_DIR:/llm/models/ \
22+
--shm-size="16g" \
23+
--entrypoint=/bin/bash \
24+
$DOCKER_IMAGE
25+
26+
docker exec -it qwen-image /bin/bash
27+
```
28+
29+
Download models before start example.
30+
Run qwen-image demo on Single GPU:
31+
```bash
32+
python3 qwen_image_example.py
33+
```
34+
35+
Run qwen-image demo on two GPUs:
36+
```bash
37+
export qwen_image_enable_two_card=1
38+
python3 qwen_image_example.py
39+
```

visual-ai/Qwen-image/build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export HTTP_PROXY=<your_http_proxy>
2+
export HTTPS_PROXY=<your_https_proxy>
3+
4+
docker build -f ./docker/Dockerfile . -t llm-scaler-visualai:qwen-image --build-arg https_proxy=$HTTPS_PROXY --build-arg http_proxy=$HTTP_PROXY
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright (C) 2025 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# ======== Base Stage ========
5+
FROM intel/deep-learning-essentials:2025.0.2-0-devel-ubuntu24.04 AS vllm-base
6+
7+
ARG https_proxy
8+
ARG http_proxy
9+
10+
# Add Intel oneAPI repo and PPA for GPU support
11+
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null && \
12+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && \
13+
add-apt-repository -y ppa:kobuk-team/intel-graphics-testing
14+
15+
# Install dependencies and Python 3.10
16+
RUN apt-get update -y && \
17+
apt-get install -y software-properties-common && \
18+
add-apt-repository ppa:deadsnakes/ppa && \
19+
apt-get update -y && \
20+
apt-get install -y python3.10 python3.10-distutils python3.10-dev && \
21+
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 && \
22+
apt-get install -y --no-install-recommends --fix-missing \
23+
curl \
24+
ffmpeg \
25+
git \
26+
libsndfile1 \
27+
libsm6 \
28+
libxext6 \
29+
libgl1 \
30+
lsb-release \
31+
numactl \
32+
wget \
33+
vim \
34+
linux-libc-dev && \
35+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
36+
# Install Intel GPU runtime packages
37+
apt-get update -y && \
38+
apt-get install -y libze1 libze-dev libze-intel-gpu1 intel-opencl-icd libze-intel-gpu-raytracing && \
39+
apt-get install -y intel-oneapi-dpcpp-ct=2025.0.1-17 && \
40+
apt-get clean && rm -rf /var/lib/apt/lists/*
41+
42+
WORKDIR /llm
43+
44+
# Set environment variables early
45+
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"
46+
47+
# ======= Add oneCCL build =======
48+
RUN apt-get update && apt-get install -y \
49+
cmake \
50+
g++ \
51+
&& rm -rf /var/lib/apt/lists/*
52+
53+
ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib/python3.10/dist-packages/torch/lib:$LD_LIBRARY_PATH"
54+
55+
RUN pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/xpu && \
56+
pip install tqdm huggingface_hub modelscope einops transformers==4.53.3 sentencepiece && \
57+
apt remove python3-blinker -y
58+
59+
COPY ./patches/qwen_image_for_multi_arc.patch /tmp/
60+
COPY ./qwen_image_example.py /llm/qwen-image/
61+
62+
RUN cd /llm && \
63+
git clone https://github.com/modelscope/DiffSynth-Studio.git && \
64+
cd ./DiffSynth-Studio && \
65+
git checkout 89bf3ce5cfe1ed5a9aa3bd2c2f74da0a82ba84f4 && \
66+
git apply /tmp/qwen_image_for_multi_arc.patch && \
67+
pip install -e .
68+
69+
70+
WORKDIR /llm/qwen-image/

0 commit comments

Comments
 (0)