m4 mac mini本地摆设ComfyUI,测试Flux-dev-GGUF的workflow模子10步出图,测 ...

海哥  金牌会员 | 2025-1-16 11:16:22 | 显示全部楼层 | 阅读模式
打印 上一主题 下一主题

主题 967|帖子 967|积分 2901


m4 mac mini已经发布了一段时间,针对这个产品,更多的是关于性价比的讨论,如果抛开各种补贴岂论,价位上和从前发布的mini其实差别不大,真要论性价比,各种windows体系的mini主机的价格其实是吊打苹果的。
本次我们针对m4 mac mini的AI性能做个测试,使用现在泛用性最广的AI工作流软件:ComfyUI框架,基于MPS(fp16)模式进行测试。
Mac Os 本地摆设ComfyUI

首先确保本机已经安装好了基于arm架构的Python3.11,之所以使用Python3.11,是由于这个版本性能有一定的优化,又不会像最新的3.13由于版本过新,引发依赖装不上的问题。
Mac版本Python3.11安装包的下载地址:
  1. https://python.org
复制代码
随后克隆官方项目:
  1. git clone https://github.com/comfyanonymous/ComfyUI.git
复制代码
接着安装 MPS 版本的 torch
  1. pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
复制代码
然后安装依赖:
  1. pip3 install -r requirements.txt
复制代码
依赖安装完毕后,需要升级一下SSL证书:
  1. bash /Applications/Python*/Install\ Certificates.command
复制代码
接着安装 ComfyUI 的 Manager 项目,用来安装各种节点:
  1. cd custom_nodes  
  2. git clone https://github.com/ltdrdata/ComfyUI-Manager.git
复制代码
至此ComfyUI项目就摆设好了。
Flux-dev-GGUF模子下载

下载需要的flux-dev模子,由于官方的模子体积太大(23G),这里我们下载GGUF的量化版本:
  1. https://pan.quark.cn/s/2907b57697fe
复制代码
模子名称分别是:flux1-dev-Q4_1.gguf和t5-v1_1-xxl-encoder-Q5_K_M.gguf,将其分别放到models的UNET目录和clip目录。
随后,回到项目的根目录,输入命令,启动ComfyUI服务:
  1. python3 main.py --force-fp16
复制代码
这里强制使用fp16精度用来提拔性能。
步伐返回:
  1. liuyue@mini ComfyUI % python3 main.py --force-fp16
  2.   [START] Security scan  [DONE] Security scan  ## ComfyUI-Manager: installing dependencies done.  ** ComfyUI startup time: 2024-12-08 23:04:08.464703  ** Platform: Darwin  ** Python version: 3.11.9 (v3.11.9:de54cf5be3, Apr  2 2024, 07:12:50) [Clang 13.0.0 (clang-1300.0.29.30)]  ** Python executable: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3  ** ComfyUI Path: /Volumes/ssd/work/ComfyUI  ** Log path: /Volumes/ssd/work/ComfyUI/comfyui.log    Prestartup times for custom nodes:     0.7 seconds: /Volumes/ssd/work/ComfyUI/custom_nodes/ComfyUI-Manager    Total VRAM 24576 MB, total RAM 24576 MB  pytorch version: 2.5.1  Forcing FP16.  Set vram state to: SHARED  Device: mps  Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention  [Prompt Server] web root: /Volumes/ssd/work/ComfyUI/web  ### Loading: ComfyUI-Manager (V2.51.9)  ### ComfyUI Revision: 2859 [b4526d3f] | Released on '2024-11-24'  [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json  [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json  [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json  [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json  Torch version 2.5.1 has not been tested with coremltools. You may run into unexpected errors. Torch 2.4.0 is the most recent version that has been tested.  [ComfyUI-Manager] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json    Import times for custom nodes:     0.0 seconds: /Volumes/ssd/work/ComfyUI/custom_nodes/websocket_image_save.py     0.0 seconds: /Volumes/ssd/work/ComfyUI/custom_nodes/ComfyUI-GGUF     0.1 seconds: /Volumes/ssd/work/ComfyUI/custom_nodes/ComfyUI-Manager     2.2 seconds: /Volumes/ssd/work/ComfyUI/custom_nodes/ComfyUI-MLX    Starting server    To see the GUI go to: http://127.0.0.1:8188
复制代码
代表摆设成功,访问:http://127.0.0.1:8188

测试Flux-dev-GGUF工作流

下载基于GGUF的工作流:
  1. https://promptingpixels.com/flux-gguf/
复制代码
导入工作流后,输入提示词:
  1. a super sexy gal holding a sign that says "ComfyUI Mac"
复制代码
意思是性感女子举着一个牌子,上面写着 ComfyUI Mac
此时,可以直接实行工作流,步伐返回:
  1. ggml_sd_loader:  
  2. 13                            144  
  3. 0                              50  
  4. 14                             25  
  5. Requested to load FluxClipModel_  
  6. Loading 1 new model  
  7. loaded completely 0.0 323.94775390625 True  
  8. Requested to load FluxClipModel_  
  9. Loading 1 new model  
  10.   
  11. ggml_sd_loader:  
  12. 1                             476  
  13. 3                             304  
  14. model weight dtype torch.bfloat16, manual cast: None  
  15. model_type FLUX  
  16. Requested to load Flux  
  17. Loading 1 new model  
  18. loaded completely 0.0 7181.8848876953125 True  
  19. 20%|██████████████████▌                                                                          | 2/10 [01:04<04:18, 32.27s/it]
复制代码
每秒的迭代稳定在30次左右,一张图大概需要3-5分钟左右。
笔者的 m4 mac mini 的配置是丐版升级到24G内存,在出图的过程中,通过活动监督器可知,内存没有被占满:

可以看到,只使用了21G的内存,有网友使用纯丐版16G内存的mini进行测试,16g内存现实刨除体系占用,空闲最多也就10g,超出的部门只能跑SSD的虚拟内存,导致GPU跑不满,所以丐版16G内存是有大概导致出图的效率低落。
末了是10步迭代的出图效果:

可以看到,精度没有下降太多,主要问题还是出图速度太慢。
结语

m4 mac mini的AI生态另有很大的提拔空间,发起AI从业者慎重购买,如果一定要买,也需要避开16G内存的版本,由于如果模子体积过大,16G内存中真正能使用的其实只有10G内存,有大概会导致模子推理效率低落,当然,我们也不能忽视m4 mac mini推理模子的优点,那就是能耗小相对省电,并且使用时的声音很小,不像N卡设备动不动就山呼海啸。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

海哥

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表