尧图建网站 尧图建网站 YAOTU WEB BUILD 免费咨询
ARTICLE DETAIL

资讯详情

深耕网站建设与建站编程的一线实战洞察。

ComfyUI ZLUDA AMD 安装

ComfyUI ZLUDA  AMD 安装 准备python3.10gitpycharm社区版最好安装anconda3可选Zludaamd hipComfyUI-Zluda遇到什么问题先重启控制台看能不能解决所有操作基于AMD显卡其他显卡可以参考安装之前先看问题有些操作需要提前使用本人非自动安装配置可参考6650xtROCM6.2/4gf1032python3.11.9cu11.8pytorch2.7.1zluda3.9.4triton3.0.06.4和6.2提升没区别懒得搞就别更新了参考A卡WINDOWS下满血运行Stable diffusionzluda使用详细教程 - 哔哩哔哩AMD 显卡Zluda 满血运行stable-diffusion-webui,ComfyUI,flux - 知乎AMD HIP官方AMD HIP SDK for Windows替换https://github.com/likelovewant/ROCmLibs-for-gfx1103-AMD780M-APU查看是否支持和GFX版本https://rocm.docs.amd.com/projects/install-on-windows/en/develop/reference/system-requirements.html老黄的显卡跳过两个勾的跳过替换这一步一个勾的就需要替换没有勾的不知道AMD NO 我的只有一个原文件备个份library放入.\Program Files\AMD\ROCm\6.2\bin\rocblasrocblas.dll放入.\Program Files\AMD\ROCm\6.2\bin\设置环境变量在win为安装ROCm的位置下的bin文件夹举个栗子C:\Program Files\AMD\ROCm\6.2\binVstudio安装AMD HIP使用C语言clang编译器需要安装win sdk和MSVC安装VStudio的C/C桌面版编译器再清理一遍缓存C:\Users\用户名\AppData\Local\Temp同时需要将MSVC路径设置进环境变量否则triton编译不通过会出错例如C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64AMDrocm安装时会自动安装VS的插件建议先安装VS如果先安装了ROCM可以将ROCM安装文件改名7Z用7Z打开找到Packages/Apps/ROCmSDKPackages/VisualStudioPlugin2022/ROCmVisualStudioPlugin2022.msi安装就行ComfyUI-ZLUDAhttps://github.com/patientx/ComfyUI-ZludaAnconda环境创建如果不使用anconda可以跳过官方推荐python版本3.11.9​可以用conda窗口创建也可以在控制窗口创建conda create -n comfyuizluda python3.11.9安装依赖运行install-n.bat安装如果是conda创建环境将install-n.bat改为txt修改Set VIRTUAL_ENV虚拟环境位置例如Set VIRTUAL_ENVG:\\ProgramData\anaconda3\envs\comfyuizluda并在conda环境中运行其中有些可能会安装失败可以自行安装安装torchtorch因为网络问题可能会下载不了可以关掉代理试试需要自行去阿里云下载对应版本手动安装AMD需要先运行一遍官方的安装代码因为官网torchcu下载速度慢torch安装完成之后运行官方安装代码会跳过安装其他依赖再卸载随后安装镜像网站下载的torchcu官网Previous PyTorch Versions仓库download.pytorch.org/whl/镜像pytorch-wheels安装包下载_开源镜像站-阿里云安装自定义版本的torch适用于AMD或者老nvidia显卡下文的zluda到目前为止只支持CU11.Xtorch最好安装11.X版本的cuda先卸载torchtorchvision和torchaudio重新安装看对应关系下载到本地安装不然会安装到其他文件夹保险可以用以下代码安装python -m pip installtorch组件对应关系PyTorch中torch、torchvision、torchaudio、torchtext版本对应关系_torch2.0.1对应的torchvision-CSDN博客AMD的话找到和rocm版本兼容的下载我是rocm6.2版本找到linux中对应的版本下载曲线救国https://pytorch.org/get-started/previous-versions/​安装完成后用pip list指令查看显示如下则完成​替换文件https://github.com/lshqqytiger/ZLUDAzluda版本分为“普通”和“nightly夜间版开发版”普通版不支持cudnn夜间版支持注意开启cudnn后速度会变快但是zluda对cudnn的支持并不完美建议禁用cudnn功能其实是懒得折腾了cudnn功能rocm6.2开始支持还要额外下载hip的cudnn扩展放入.\AMD\ROCm\6.2HIP扩展下载https://drive.google.com/file/d/1Gvg3hxNEj2Vsd2nQgwadrUEY6dYXy0H9/view?uspsharing自动安装6.2rocm安装需要启动patchzluda2.bat如果是conda环境修改内容set torch_dir%~dp0venv\Lib\site-packages\torch\lib为set torch_dir环境位置\Lib\site-packages\torch\lib例如set torch_dirG:\\ProgramData\anaconda3\envs\comfyuizluda\Lib\site-packages\torch\lib如果要修改zluda版本运行bat后把链接复制到CMD窗口Enter URL:一栏即可手动安装下载对应HIP版本的zluda打开文件夹内cublas.dll改名为cublas64_11.dllcusparse.dll改名为cusparse64_11nvrtc.dll改名为nvrtc64_112_0.dll打开.\anaconda3\envs\环境\Lib\site-packages\torch\lib进行替换​cudnn的兼容性禁用cudnn方法修改文件存疑设置环境变量DISABLE_ADDMM_CUDA_LT1打开ComfyUI-Zluda/main.py添加代码如果此种方法不行可以在生成节点中设置import torch torch.backends.cudnn.enabled False torch.backends.cuda.enable_flash_sdp(False) torch.backends.cuda.enable_math_sdp(True) torch.backends.cuda.enable_mem_efficient_sdp(False) torch.backends.cuda.enable_cudnn_sdp(False)如果已经启动过comfyui了建议删除缓存C:\Users\radic\.tritonC:\Users\radic\AppData\Local\ZLUDA工作流节点中设置将.\ComfyUI-Zluda\cfz\中的3个cfz文件放入.ComfyUI-Zluda\custom_nodes然后启用cfz_cudnn节点cudnn选择false​​运行后会显示代表成功​启动模拟环境运行如果不使用anconda可以跳过打开comfyui-n.bat找到这两项set PYTHON%~dp0/venv/Scripts/python.exeset VENV_DIR./venv改为set PYTHON环境位置/Scripts/python.exeset VENV_DIR-例如C:\\anaconda3\envs\comfyuizluda\Scripts\python.exe夜间版使用夜间版本可以在comfyui-nset中的COMMANDLINE_ARGS加上--use-zluda--use-nightl启动项comfyui-n.bat启动后成功的话界面就会出来​如果出现fatal: not a git repository (or any of the parent directories): .git参考Git篇使用Git将代码库更新到本地完整版_git如何更新本地项目-CSDN博客bat内的位置修改好了还是在环境中运行comfyui-n.bat就能启动CMD窗口如下就代表成功​运行过程中可能会跳错误认真看一遍是否有warning和error安装遇到的问题ERROR: Could not install packages due to an OSError: [WinError 32] 另一个程序正在使用此文件解决看看缺什么自行下载安装Using HIP SDK Clang.clang: warning: unable to find a Visual Studio installationerror:stdio.h file not found记得安装VStudio和必须的插件warning: declaration of struct timeval will not be visible outside of this function [-Wvisibility]184 | struct timeval *tv,clang: error: linker command failed with exit code 1104 (use -v to see invocation)不能编译titron导致的设置MSCV环境变量了吗好好看看安装过程啊ばか.\triton\backends\amd\include\hip/hip_runtime.h:49:10: fatal error:stdio.h file not found49 | #include stdio.h1 error generated.Triton test failed: CommandVStudio中win sdk版本安装错误解决注意操作系统和winsdk是否匹配并且删除C:\Users\用户名\AppData\Local\Temp中的VStudio缓存直接删除所有文件删不掉的跳过不影响使用Triton test failed: CUDA unknown error- this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero使用lshqqytiger的zluda只能使用自定义Tritonlshqqytiger/triton: Development repository for the Triton language and compilerhttps://github.com/patientx/ComfyUI-Zluda/issues/128如果还不行特别情况特别分析woct0rdho/triton-windows: Fork of the Triton language and compiler for Windows support and easy installation如果是默认环境在comfyuizluda文件夹下创建test_triton.py然后运行python test_triton.py如果是conda环境cd到环境目录下创建test_triton.py例如cd /d G:\\ProgramData\anaconda3\envs\环境名字\Lib\site-packages然后运行python test_triton.pyimport torch import triton import triton.language as tl triton.jit def add_kernel(x_ptr, y_ptr, output_ptr, n_elements, BLOCK_SIZE: tl.constexpr): pid tl.program_id(axis0) block_start pid * BLOCK_SIZE offsets block_start tl.arange(0, BLOCK_SIZE) mask offsets n_elements x tl.load(x_ptr offsets, maskmask) y tl.load(y_ptr offsets, maskmask) output x y tl.store(output_ptr offsets, output, maskmask) def add(x: torch.Tensor, y: torch.Tensor): output torch.empty_like(x) n_elements output.numel() grid lambda meta: (triton.cdiv(n_elements, meta[BLOCK_SIZE]),) add_kernel[grid](x, y, output, n_elements, BLOCK_SIZE1024) return output a torch.rand(3, devicecuda) b a a b_compiled add(a, a) print(b_compiled - b) print(If you see tensor([0., 0., 0.], devicecuda:0), then it works)Triton test failed: CUDA error: operation not supportedCUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.For debugging consider passing CUDA_LAUNCH_BLOCKING1Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.更新cu版本后不兼容启动遇到的问题WARNING: some comfy_extras/ nodes did not import correctly. This may be because they are missing some dependencies.缺少flash-attention或者版本错误安装对应版本不要安装到linux版本了https://github.com/comfyanonymous/ComfyUI/issues/2991CUDA12轮子GitHub - kingbri1/flash-attention: Fast and memory-efficient exact attention · GitHubReleases · sdbds/flash-attention-for-windows · GitHubOSError: [WinError 126] 找不到指定的模块。Error loading cublas64_11.dll or one of its dependencies.替换zluda前正常替换后出现因为缺少rocm的文件解决一般是没有配置hip环境配置后还不行查看下缺少什么文件解决“OSError: [WinError 126] 找不到指定的模块” - 哔哩哔哩使用遇到的问题点不动某些选项浏览器插件影响了关闭插件就行比如翻译软件什么的RuntimeError: GET was unable to find an engine to execute this computationFile G:\ProgramData\anaconda3\envs\comfyuizluda\Lib\site-packages\torch\nn\modules\module.pyGET was unable to find an engine to execute this computationreturn F.conv2d(cudnn相关如果没有安装cudnnHIP拓展和zluda夜间版就启用不了cudnn需要屏蔽cudnnRuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
返回列表