#背景mac用这个5600xt用mps后端太慢了比cpu只快一点,windows用dml后端居然不能用torch2.4或者torch version进行视频生成
只能用rocm后端了,这就必须是linux
#确认gfx的名称
##gfx1030是有的 gfx1010是无法编译的,用的时候加上export HSA_OVERRIDE_GFX_VERSION=10.3.0
##必须ubuntu24.04,旧版需要装intel的base很麻烦
#rocm6.3.3或者以上,不要自己编译rocm,很麻烦的,试过还是无法gfx1010
#编译是成功的 可是rocm6.3.3 hip库里还是没有1030的ran1支持,后来才知道rocm的1030只能是ran2以上的,不是改了就能用的
我没有5700,希望5700的用户能成功,我是用不上comfyui了,一到sample就爆内存,好像是内存益出。这篇文章当记录,感兴趣自己
去拿5700看下
conda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh
conda config --set auto_activate_base false
conda create -n sd python=3.10 -y
conda activate sd
torch:
git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive
pip install -r requirements.txt
conda install cmake ninja
pip install mkl-static mkl-include
export CMAKE_PREFIX_PATH="${CONDA_PREFIX:-'$(dirname $(which conda))/../'}:${CMAKE_PREFIX_PATH}"
PYTORCH_ROCM_ARCH=gfx1030 python3 setup.py bdist_wheel
version
git clone https://github.com/pytorch/vision.git
cd vision
conda install -c conda-forge 'ffmpeg<4.3'
conda install libpng libjpeg-turbo -c pytorch
pip install expecttest flake8 typing mypy pytest pytest-mock scipy requests
python setup.py bdist_wheel
audio
git clone https://github.com/pytorch/audio.git
cd audio
python setup.py bdist_wheel
最后把/home/zalo/vision/dist /home/zalo/audio/dist /home/zalo/pytorch/dist里的wheel放一起
comfyUI:
conda create -n cf python=3.10 -y
conda activate cf
cd /home/zalo/wheel
pip3 install torch-2.8.0a0+git157bff2-cp310-cp310-linux_x86_64.whl torchaudio-2.6.0a0+318bace-cp310-cp310-linux_x86_64.whl torchvision-0.22.0a0+309bd7a-cp310-cp310-linux_x86_64.whl
检测
python3 -c 'import torch' 2> /dev/null && echo 'Success' || echo 'Failure'
python3 -c 'import torch; print(torch.cuda.is_available())'
返回Success
True
cd ~
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
pip3 install -r requirements.txt
cd custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager
cd ComfyUI-Manager
pip3 install -r requirements.txt
启动脚本
cat <<EOF > ~/ComfyUI/launch.sh
#!/bin/sh
##source venv/bin/activate
export HSA_OVERRIDE_GFX_VERSION=10.3.0
export HIP_VISIBLE_DEVICES=0
export PYTORCH_HIP_ALLOC_CONF=garbage_collection_threshold:0.8,max_split_size_mb:512
python3 main.py --force-fp16
EOF
#说明
#这个参数很基本的
后期自己在ComfyUI下launch.sh改下就OK
export PYTORCH_HIP_ALLOC_CONF=garbage_collection_threshold:0.8(使用率80%就清除GPU)
max_split_size_mb:512(单位是512mb,如果是128就散了 64就会内存碎片
--listen --dont-upcast-attention(分散注意力,不知道哦现在编译好的rocm pytorch是否可以flash attention,
好像可以的,也可以加 force-fp16 因为5600xt就是这个 如果爆内存还可以把节点放cpu上,sample放其他GPU上 vae放5600xt上
平时启动
conda activate cf
cd ~/ComfyUI
bash launch.sh
打开网站*可以改端口或IP
不能用全局代理
127.0.0.1:8188