Quantcast
Channel: プログラミング
Viewing all articles
Browse latest Browse all 8011

Intel MacにComfyUI実行環境を構築する手順 - Mac って何?それって美味しいの?

$
0
0

ComfyUI実行画面


この記事では、Intel MacにComfyUIの実行環境を構築する手順を簡略化して説明します。Pythonの仮想環境を使用し、ComfyUIと関連する依存関係をインストールします。また、ComfyUI-Managerをセットアップする方法や、Numpyに関するエラーの対処方法についても解説します。

 

前提条件

pythonインストール済みであること。インストール方法はAUTOMATIC1111やForgeの手順を参照してください。AUTOMATIC1111やForgeが実行可能であればComfyUIも可能と思います。

 

yummac.hatenablog.jp

 

1. ComfyUIのクローンとセットアップ

まず、ComfyUIのリポジトリをクローンし、Pythonの仮想環境を作成します。

cd ~
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip

 

2. 依存関係のインストール

CPUバージョンのPyTorchをインストールします。これには、ナイトリービルドを使用します。その後、その他の依存関係をインストールします。

pip3 install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
pip install -r requirements.txt

 

3. AUTOMATIC1111のパス参照の設定(任意)

ComfyUIがAUTOMATIC1111のmodel等を参照可能にする設定をします。`extra_model_paths.yaml.example`という設定ファイルを`extra_model_paths.yaml`にリネーム後、テキストエディタで開いてbase_path部分に参照するAUTOMATIC1111のパスを記述します。

base_path: path/to/stable-diffusion-webui/
例)
base_path: /Users/(ユーザ名)/stable-diffusion-webui

 

4. ComfyUIの実行

仮想環境を有効化し、ComfyUIを実行します。すでに仮想環境が有効化((venv)がプロンプト先頭に表示)されているなら、`source venv/bin/activate`は不要です。

cd ~/ComfyUI
source venv/bin/activate
python main.py --cpu

ComfyUIの起動完了するとターミナルにURLが表示されます。そのURL(`http://127.0.0.1:8188`)をブラウザで開きます。

Starting server
To see the GUI go to: http://127.0.0.1:8188

実行を停止するには `Ctrl + C` を押します。その後、仮想環境を無効化します。

deactivate

 

5. ComfyUI-Managerのインストール

ComfyUI-Managerをインストールして、カスタムノードを管理します。

cd ~/ComfyUI/custom_nodes
git clone https://github.com/ltdrdata/ComfyUI-Manager.git

 

6. Numpyのエラーメッセージへの対処

もし「Numpy is not available」というエラーが出た場合、Numpyのバージョンが関係している恐れがあります。その場合、Numpyのバージョンを下げることで対処できます。

cd ~/ComfyUI
source venv/bin/activate
pip uninstall numpy
pip install numpy==1.26.4

以上で、Intel MacにComfyUI実行環境を構築する手順は完了です。これで、ComfyUIを使って様々なタスクを実行できるようになります。質問や問題がある場合は、コメント欄でお知らせください。


Viewing all articles
Browse latest Browse all 8011

Trending Articles