通义千问团队推出了 Qwen-Image-Layered模型,它能够将图像分解为多个RGBA图层。这种分层表征方式赋予了图像与生俱来的可编辑性:每个图层均可独立操控,不会影响其他内容。同时,该分层表征天然支持高保真的基础操作,例如调整尺寸、移动位置和修改色彩。通过将语义或结构元素物理隔离至不同图层,实现了高保真且风格统一的图像编辑。
昇腾支持该模型开箱部署推理并通过MindIE SD加速套件为其提供极致性能优化。
Qwen-Image-layered的亮点包括:
设备支持 Atlas 800I/800T A2(8*64G)推理设备:支持的卡数最小为1
Atlas 800I/800T A2(8*64G): https://www.hiascend.com/developer/download/community/result?module=pt+ie+cann&product=4&model=32
MindIE SD仓库链接: https://gitcode.com/Ascend/MindIE-SD
vllm-ascend镜像: https://quay.io/repository/ascend/vllm-ascend
环境准备指南: https://docs.vllm.ai/projects/vllm-omni/en/latest/getting_started/installation/npu/
# Update the vllm-ascend image
export IMAGE=quay.io/ascend/vllm-ascend:v0.12.0rc1
docker run --rm \
--name vllm-omni-npu \
--shm-size=1g \
--device /dev/davinci_manager \
--device /dev/devmm_svm \
--device /dev/hisi_hdc \
-v /usr/local/dcmi:/usr/local/dcmi \
-v /usr/local/bin/npu-smi:/usr/local/bin/npu-smi \
-v /usr/local/Ascend/driver/lib64/:/usr/local/Ascend/driver/lib64/ \
-v /usr/local/Ascend/driver/version.info:/usr/local/Ascend/driver/version.info \
-v /etc/ascend_install.info:/etc/ascend_install.info \
-v /root/.cache:/root/.cache \
-p 8000:8000 \
-it $IMAGE bash # 增加软件包可执行权限,{version}表示软件版本号,{arch}表示CPU架构。
chmod +x ./Ascend-mindie_${version}_linux-${arch}.run
./Ascend-mindie_${version}_linux-${arch}.run --check
# 方式一:默认路径安装
./Ascend-mindie_${version}_linux-${arch}.run --install
# 设置环境变量
cd /usr/local/Ascend/mindie && source set_env.sh
# 方式二:指定路径安装
./Ascend-mindie_${version}_linux-${arch}.run --install-path=${AieInstallPath}
# 设置环境变量
cd ${AieInstallPath}/mindie && source set_env.sh下载 pytorch_v{pytorchversion}_py{pythonversion}.tar.gz
tar -xzvf pytorch_v{pytorchversion}_py{pythonversion}.tar.gz
# 解压后,会有whl包
pip install torch_npu-{pytorchversion}.xxxx.{arch}.whl# Qwen-Image-Layered权重链接:
https://huggingface.co/spaces/Qwen/Qwen-Image-Layered# 1. 下载代码
git clone https://github.com/vllm-project/vllm-omni.git && cd vllm-omni
# 2. python相关依赖安装
pip install -v -e .单卡性能测试
python examples/offline_inference/image_to_image/image_edit.py \
--model Qwen/Qwen-Image-Layered \
--image img1.png \
--output output_image_layered \
--layers 2 \
--color-format "RGBA" \
--cache_backend cache_dit \其中,参数详细描述如下:
多卡性能测试
export ASCEND_RT_VISIBLE_DEVICES=0,1,2,3
export HCCL_OP_EXPANSION_MODE="AIV"
python examples/offline_inference/image_to_image/image_edit.py \
--model Qwen/Qwen-Image-Layered \
--image img1.png \
--output output_image_layered \
--layers 2 \
--color-format "RGBA" \
--cache_backend cache_dit \
--ulysses_degree 4 \其中,参数详细描述如下: