見出し画像

MacでFLUXを試してみた:DiffusionKit

Xで流れてきたPost通りにやったら、画像が生成されました。
Image Gnereationはほとんどまったく触れていないのですが、FLUXが今話題だというのはXを見てて知っています。
そんな中、下記のPost


とりあえず、よくわからないけど、pip でdiffusionkitをインストールしたら、コマンドラインを放り込んだら画像生成できそうです。
ちなみにDiffusionKitのgithubはこちら。

いろいろ書いてありますが、XのPostだと、pip installでできそうなので、とりあえずmkdirで、この作業用directoryを作って、mlxのconda環境上で下記を実行

pip install diffusionkit

なにかいろいろダウンドーロとインストールはうまく行ったようです。

Successfully installed argmaxtools-0.1.13 beartype-0.18.5 cattrs-23.2.3 coremltools-7.2 diffusionkit-0.3.1 jaxtyping-0.2.33 protobuf-3.20.3 pyaml-24.7.0 tabulate-0.9.0 typeguard-2.13.3

次は、Postにあった、コマンドラインをそのままコピペして実行

diffusionkit-cli --prompt "detailed cinematic dof render of a detailed MacBook Pro on a wooden desk in a dim room with items around, messy dirty room. On the screen are the letters 'FLUX on DiffusionKit' glowing softly. High detail hard surface render" --height 768 --width 1360 --seed 1001 --step 4 --benchmark-mode --model-version FLUX.1-schnell

diffusionkit-cli --prompt "detailed cinematic dof render of a detailed MacBook Pro on a wooden desk in a dim room with items around, messy dirty room. On the screen are the letters 'FLUX on DiffusionKit' glowing softly. High detail hard surface render" --height 768 --width 1360 --seed 1001 --step 4 --benchmark-mode --model-version FLUX.1-schnell

いや、これはダウンロードファイルがまたいろいろあって、時間がかかりました。下が一番時間がかかったかな。

flux-schnell.safetensors: 100%|████████████| 23.8G/23.8G

最後の出力部分は下記で、out.pngが実行Directoryの中に作られました。

INFO:diffusionkit.mlx:Post denoise peak memory: 31.365GB
INFO:diffusionkit.mlx:Post denoise active memory: 25.315GB
INFO:diffusionkit.mlx:Denoising time: 34.783s
INFO:diffusionkit.mlx:Pre decode peak memory: 0.0GB
INFO:diffusionkit.mlx:Pre decode active memory: 25.315GB
INFO:diffusionkit.mlx:Post decode peak memory: 35.298GB
INFO:diffusionkit.mlx:Post decode active memory: 25.32GB
INFO:diffusionkit.mlx:============= Summary =============
INFO:diffusionkit.mlx:Text encoder: 0.9s
INFO:diffusionkit.mlx:Denoising: 34.8s
INFO:diffusionkit.mlx:Image decoder: 4.2s
INFO:diffusionkit.mlx:Peak memory: 35.3GB
INFO:diffusionkit.mlx:============= Inference Context =============
INFO:diffusionkit.mlx:Operating System:
{'os_build_number': '23G93', 'os_type': 'macOS', 'os_version': '14.6.1'}
INFO:diffusionkit.mlx:Device:
{'cpu_core_count': 16,
'gpu_core_count': 40,
'max_ram': '67775447040',
'product_name': 'Apple M3 Max'}
INFO:diffusionkit.mlx:Total time: 40.3s
INFO:diffusionkit.mlx.scripts.generate_images:Saved the image to out.png

できた画像は、Seedも指定されていたので、XのPostとそっくりでした。

X で #FLUXタグでプロンプトを探してみます 。とりあえず、altにプロンプトが書かれている以下のポストを発見。

右下のプロンプトは、Prompt: "lush rainforest jungle, cinematic" なので、これを試してみます。--seed は特に指定しないことにして外して、実行

diffusionkit-cli --prompt "lush rainforest jungle, cinematic" --height 768 --width 1360  --step 4 --benchmark-mode --model-version FLUX.1-schnell

diffusionkit-cli --prompt "lush rainforest jungle, cinematic" --height 768 --width 1360 --step 4 --benchmark-mode --model-version FLUX.1-schnell

こんなイメージがでました。綺麗ですね。

Terminalにでた出力のSummaryだけ掲載します

INFO:diffusionkit.mlx:============= Summary =============
INFO:diffusionkit.mlx:Text encoder: 0.4s
INFO:diffusionkit.mlx:Denoising: 34.7s
INFO:diffusionkit.mlx:Image decoder: 1.4s
INFO:diffusionkit.mlx:Peak memory: 35.2GB

とりあえず動かしてみた、やってみた報告ノートでした。


#AI #AIとやってみた #やってみた #画像生成 #FLUX #Diffusionkit #MacbookPro


この記事を最後までご覧いただき、ありがとうございます!もしも私の活動を応援していただけるなら、大変嬉しく思います。