OpenMythosのサンプルプログラムを動かしました

1.概要 前回、OpenMythosの環境構築まで実現したので、GitHubにあるサンプルプログラム(Usage)を動かしてみました。一部エラーが発生しましたが、結果出力部分なので修正をしました。その内容を記述します。 2.詳細 Usageに記載されているPythonプログラムをopenmythos_usage.pyとして作成します。 $ source ~/mypy/bin/activate (mypy) $ pythoh3 openmythos_usage.py 下記エラーとなります [MLA] Parameters: 1,538,626 [MLA] Logits shape: torch.Size([2, 16, 1000]) [MLA] Generated shape: torch.Size([2, 24]) Traceback (most recent call last):   File "/home/nakasima/openmythos/openmythos_usage.py", line 48, in <module>     rho = torch.linalg.eigvals(A).abs().max().item()           ^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: linalg.eig: The input tensor A must have at least 2 dimensions. コードの下記部分を修正します #rho = torch.linalg.eigvals(A).abs().max().item() rho = A.abs().max().item() $ source ~/mypy/bin/activate (mypy) $ pythoh3 openmythos_usage.py [MLA] Parameters: 1,538,626 [MLA] Logits shape: torch.Size([2, 16, 1000]) [MLA] Generated shape: torch.Size([2, 24]) [MLA] Spectral radius ρ(A) = 0.3679 (mus...

Stable Diffusionをubuntu 22.04でCPUのみで試しました

 1.概要

Stable DiffusionはGPU必須となっていますが、CPUだけでも実行できるとの記事を見つけて試してみました。確かにインストールはできますが、実行すると速度が遅いだけのようです。GPU版を知っているとCPU版では満足できない速度かも知れません。その内容を記述します。

2.詳細

GPU版と同じ環境を利用しました。セットアップ方法の差でCPU版になります。

環境は以下のとおりです
cpu     core i3-7100
memory  16GB
SSD     250GB

手順は以下のとおりです。参考資料に沿って実行します。
(a) Stable Diffusionのインストールと起動
(b) GUI利用

(a) Stable Diffusionのインストールと起動

準備として下記モジュールをインストールします
$ sudo apt-get -y install git
$ sudo apt -y install python3-pip python3-venv python3-packaging

$ git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
$ cd ~/stable-diffusion-webui
$ python3 launch.py --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate --precision full --no-half

何故かstable-diffusion-webui/launch.pyでエラーになります。
Traceback (most recent call last):
  File "/home/nakasima/stable-diffusion-webui/launch.py", line 48, in <module>
    main()
  File "/home/nakasima/stable-diffusion-webui/launch.py", line 44, in main
    start()
  File "/home/nakasima/stable-diffusion-webui/modules/launch_utils.py", line 465, in start
    import webui
  File "/home/nakasima/stable-diffusion-webui/webui.py", line 13, in <module>
    initialize.imports()
  File "/home/nakasima/stable-diffusion-webui/modules/initialize.py", line 15, in imports
    import torch  # noqa: F401
ModuleNotFoundError: No module named 'torch'

下記コマンドを再実行しました
$ python3 launch.py --skip-torch-cuda-test --upcast-sampling --no-half-vae --use-cpu interrogate --precision full --no-half

ダウンロードが実行されて、起動します。

(d) GUI利用

Running on local URL:  http://0.0.0.0:7860
の表示が出ているので、ブラウザ(Firefox)から
http://localhost:7860/
でGUIに接続します。

参考
[外部サイト参照]
Stable Diffusion Web UIをグラボなしCPUのみで使う方法

コメント

このブログの人気の投稿

miniPCのBMAXでWindows11のsecure boot設定漏れでトラブル発生

LinuxMint-22.3にWine 11.6をサクッと入れてみました

LinuxMint 21.3にWinBoat導入を試してみました