wordpress 設(shè)置數(shù)據(jù)庫南陽網(wǎng)站seo
歡迎關(guān)注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://spike.blog.csdn.net/article/details/141140498
免責(zé)聲明:本文來源于個人知識與公開資料,僅用于學(xué)術(shù)交流,歡迎討論,不支持轉(zhuǎn)載。
ComfyUI 是功能強(qiáng)大且高度模塊化的 AI 繪畫工具,基于 Stable Diffusion 技術(shù),采用節(jié)點(diǎn)式工作流界面,使用戶能夠更直觀地控制圖像生成過程。特點(diǎn)是模塊化設(shè)計(jì),允許用戶通過拖放節(jié)點(diǎn)來創(chuàng)建和調(diào)整工作流,極大地提高了靈活性和可定制性。速度更快,靈活的組建工作流,專業(yè)團(tuán)隊(duì)的需求,節(jié)點(diǎn)式編輯。
GitHub: https://github.com/comfyanonymous/ComfyUI
git clone https://github.com/comfyanonymous/ComfyUI
配置 conda 環(huán)境
conda create -n comfyui python=3.9
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu117
pip install numpy==1.26.4
Numpy 必須是 1.x 版本,否則報錯:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
安裝其他庫:
pip install -r requirements.txt
啟動任務(wù),默認(rèn)端口是 8188:
python3 main.py --listen 0.0.0.0
# nohup python3 -u main.py --listen 0.0.0.0 > nohup.run_main.out &
# ps -aux | grep "main.py"
# kill -9 [pid]
啟動成功的日志,例如 http://[your ip]:8188/:
Total VRAM 81052 MB, total RAM 1031523 MB
pytorch version: 1.13.1+cu117
Set vram state to: NORMAL_VRAM
Device: cuda:0 NVIDIA A100-SXM4-80GB :
Using sub quadratic optimization for cross attention, if you have memory or speed issues try using: --use-split-cross-attention
[Prompt Server] web root: workspace_comfyui/ComfyUI/webImport times for custom nodes:0.0 seconds: workspace_comfyui/ComfyUI/custom_nodes/websocket_image_save.pyStarting serverTo see the GUI go to: http://0.0.0.0:8188
ComfyUI 啟動成功:
ComfyUI 支持復(fù)用 Stable Diffusion WebUI 的配置,修改 extra_model_paths.yaml
:
a111:base_path: workspace/stable_diffusion_webui/checkpoints: models/Stable-diffusionconfigs: models/Stable-diffusionvae: models/VAEloras: |models/Loramodels/LyCORISupscale_models: |models/ESRGANmodels/RealESRGANmodels/SwinIRembeddings: embeddingshypernetworks: models/hypernetworkscontrolnet: extensions/sd-webui-controlnet/models
注意:需要修改 controlnet 的默認(rèn)模型路徑,這個部分與默認(rèn)不一致,其他逐個驗(yàn)證即可。
在 workspace_comfyui/ComfyUI/custom_nodes
文件夾中,安裝自定義 ComfyUI-Manager 插件:
- ComfyUI-Manager: https://github.com/ltdrdata/ComfyUI-Manager
第 1 次啟動時,需要等待安裝配置,## ComfyUI-Manager: installing dependencies. (GitPython)
安裝翻譯插件:AIGODLIKE-ComfyUI-Translation,重啟服務(wù)即可:
cd custom_nodes
git clone https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation.git
將 ComfyUI 頁面翻譯成中文:
點(diǎn)擊 Queue Prompt,即可運(yùn)行程序。
提示詞:
- beautiful scenery nature glass bottle landscape, purple galaxy bottle,
- 美麗的風(fēng)景自然玻璃瓶景觀,紫色銀河瓶。
如圖所示:
運(yùn)行報錯:
File "workspace_comfyui/ComfyUI/custom_nodes/ComfyUI-Manager/glob/manager_server.py", line 1710, in <lambda>threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()File "envs/comfyui/lib/python3.9/asyncio/runners.py", line 44, in runreturn loop.run_until_complete(main)File "aiohttp/client_reqrep.py", line 1014, in startself._continue = NoneFile "aiohttp/helpers.py", line 713, in __exit__raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
原因是 GitHub 國內(nèi)訪問異常,使用代理即可,參考源碼 ComfyUI-Manager/glob/manager_server.py#1688
,即:
async def default_cache_update():async def get_cache(filename):# uri = 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/' + filenameuri = 'https://mirror.ghproxy.com/https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/' + filenamecache_uri = str(core.simple_hash(uri)) + '_' + filenamecache_uri = os.path.join(core.cache_dir, cache_uri)json_obj = await core.get_data(uri, True)with core.cache_lock:with open(cache_uri, "w", encoding='utf-8') as file:json.dump(json_obj, file, indent=4, sort_keys=True)print(f"[ComfyUI-Manager] default cache updated: {uri}")a = get_cache("custom-node-list.json")b = get_cache("extension-node-map.json")c = get_cache("model-list.json")d = get_cache("alter-list.json")e = get_cache("github-stats.json")await asyncio.gather(a, b, c, d, e)threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()
修改 uri,增加 https://mirror.ghproxy.com/
前綴,即可
參考:https://github.com/runningcheese/MirrorSite