お知らせ

現在サイトのリニューアル作業中のため、全体的にページの表示が乱れています。

生のHTTPメッセージを見たい時に使える方法。devtoolsではフォーマットされたログしか見れないが、生のテキストを見たい時に使える。具体的には以下の画像のような奴だ。

image-1706238902445.png

よく忘れるのでメモとして残しておく

確認環境

Env Ver
Google Chrome 120.0.6099.225
Microsoft Edge 120.0.2210.144

やり方

chrome://net-internals/にアクセスするとログ収集ができるので、ログを集めたらイベントビューワで見ればよい。なおイベントビューワは外部サイトなので注意。

以前はブラウザ内で完結していて、リアルタイムに見れたはずだが、何故かできなくなっていた。

Edgeの場合はedge://net-internals/でもアクセスできるが、特にこだわりがなければ汎用性の高いchrome://net-internals/でよいと思う。

タイトルの通りさくらのレンタルサーバーにTiny Tiny RSSを構築する話。いつの間にかDockerコンテナにされてたが本体は単純なPHPのままなのできちんと設定してやるとDocker環境がなくとも動く。

確認環境

Env Ver
Tiny Tiny RSS dc25a9cf6816b756cb38490eab93f02589c44a10

手順

以降Tiny Tiny RSSをTTRSS表記とする。

  1. さくらのコンパネからTTRSSで利用するDBを作る
  2. 以下のセットアップスクリプトを適宜書き換えて実行する
git clone https://git.tt-rss.org/fox/tt-rss.git

cd tt-rss/

cat <<'EOF' | > config.php
<?php
# This file can be used to customize global defaults if environment method is not available (i.e. no Docker).
#
# Use the following syntax to override defaults (options are declared in classes/config.php, prefixed by TTRSS_):
#
# putenv('TTRSS_SELF_URL_PATH=http://example.com/tt-rss');
#
# Plugin-required constants also go here, using define():
#
# define('LEGACY_CONSTANT', 'value');
#
# See this page for more information: https://tt-rss.org/wiki/GlobalConfig

putenv('TTRSS_PHP_EXECUTABLE=/usr/local/bin/php');

# Sets admin user access level to this value.
# Valid values:
# -2 - forbidden to login
# -1 - readonly
#  0 - default user
# 10 - admin
putenv('ADMIN_USER_ACCESS_LEVEL=10');

# Database
putenv('TTRSS_DB_TYPE=mysql');
putenv('TTRSS_DB_HOST=database.example.com');
putenv('TTRSS_DB_PORT=3306');
putenv('TTRSS_DB_USER=hoge');
putenv('TTRSS_DB_NAME=piyo');
putenv('TTRSS_DB_PASS=fuga');

# You will likely need to set this to the correct value, see README.md
# for more information.
putenv('TTRSS_SELF_URL_PATH=https://example.com/');
EOF

php update.php --update-schema
  1. TTRSSを設置したURLにアクセスする
  2. ID: admin, PW: password でログインする
  3. ログインパスワードを変更する
  4. 適当にフィードを登録する
  5. php update.php --feeds を流す
  6. TTRSSの画面でフィードが取得できることを確認する
  7. cronに以下のコマンドを適当に登録する
    • /usr/local/bin/php /home/<USER>/www/tt-rss/update.php --feeds --quiet 1> /dev/null

トラブルシューティング

TTRSS画面を開くとエラーが出る:Exception while creating PDO object:could not find driver

.envに設定を書いても読み込まれないのでconfig.phpに書く

TTRSS画面上にRSSの取得失敗エラーが出る:Update process failed with exit code: 127 ()

以下のコマンドを実行したときにエラーが出る筈なので、それを見て対処する

php update.php --force-update
php update.php --feeds

phpのパスが見つからないと言われた場合はconfig.phpputenv('TTRSS_PHP_EXECUTABLE=<PHP_PATH>');を追加して、phpのパスを設定すれば直る

フィードを追加しても更新されない

勝手に更新されることはないのでCRONが走るのを待つか以下のコマンドを流す

php update.php --feeds

Androidアプリが欲しい

Google Playにはなく、公式サイトからapkを落としてくる必要がある。
昔は有料だったが今は地味に無料化されている。

https://gitlab.tt-rss.org/tt-rss/tt-rss-android/-/releases

参考情報

事前準備

事前に必要なコンポーネントをインストールしておく

セットアップコマンド

MSYS2などのPOSIX互換レイヤー上のシェルで動かすことを想定

# get Stable Diffusion web UI
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

# get extentions
git clone https://github.com/nolanaatama/sd-webui-tunnels stable-diffusion-webui/extensions/sd-webui-tunnels
git clone https://github.com/Mikubill/sd-webui-controlnet stable-diffusion-webui/extensions/sd-webui-controlnet
git clone https://github.com/fkunn1326/openpose-editor stable-diffusion-webui/extensions/openpose-editor
git clone https://github.com/yfszzx/stable-diffusion-webui-images-browser stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser
git clone https://github.com/DominikDoom/a1111-sd-webui-tagcomplete stable-diffusion-webui/extensions/a1111-sd-webui-tagcomplete
git clone https://github.com/Bing-su/dddetailer stable-diffusion-webui/extensions/dddetailer
git clone https://github.com/mcmonkeyprojects/sd-dynamic-thresholding stable-diffusion-webui/extensions/d-dynamic-thresholding

# make resource dirs
mkdir -p stable-diffusion-webui/models/ESRGAN/
mkdir -p stable-diffusion-webui/models/Lora/
mkdir -p stable-diffusion-webui/models/VAE/
mkdir -p stable-diffusion-webui/models/hypernetworks/
mkdir -p stable-diffusion-webui/extensions/sd-webui-controlnet/models/

# get controlnet
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_canny_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_canny_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_color_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_color_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_depth_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_depth_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_keypose_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_keypose_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_openpose_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_openpose_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_seg_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_seg_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_sketch_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_sketch_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/t2iadapter_style_sd14v1.pth https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_style_sd14v1.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11e_sd15_ip2p.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11e_sd15_shuffle.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11f1e_sd15_tile.pth.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile.pth.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11f1p_sd15_depth.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_canny.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_inpaint.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_lineart.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_mlsd.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_normalbae.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_openpose.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_scribble.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_seg.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15_softedge.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge.pth
curl -Lo stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_v11p_sd15s2_lineart_anime.pth https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime.pth

# get embeddings
curl -Lo stable-diffusion-webui/embeddings/badhandv4.pt https://civitai.com/api/download/models/20068
curl -Lo stable-diffusion-webui/embeddings/EasyNegative.pt https://huggingface.co/datasets/gsdf/EasyNegative/resolve/main/EasyNegative.pt

# get model
# upscaler
curl -Lo stable-diffusion-webui/models/ESRGAN/4x-UltraSharp.pth https://huggingface.co/nolanaatama/ESRGAN/resolve/main/4x-UltraSharp.pth
curl -Lo stable-diffusion-webui/models/ESRGAN/TGHQFace8x_500k.pth https://huggingface.co/dwnmf/deliberatev2/resolve/main/TGHQFace8x_500k.pth

# model
curl -Lo stable-diffusion-webui/models/Stable-diffusion/AOM3A1B_orangemixs.safetensors https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A1B_orangemixs.safetensors

# vae
curl -Lo stable-diffusion-webui/models/VAE/orangemix.vae.pt https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt
curl -Lo stable-diffusion-webui/models/VAE/kl-f8-anime2.ckpt https://huggingface.co/hakurei/waifu-diffusion-v1-4/resolve/main/vae/kl-f8-anime2.ckpt

起動コマンド

dddetailerの依存ライブラリインストールで初回起動はかなり時間が掛かるので気長に待つ。

./webui-user.bat

設定

  1. Settings -> User Interface
  2. Quicksettings listに以下を追加
    • , sd_vae, CLIP_stop_at_last_layers
投稿日:
ソフトウェア::Stable Diffusion技術::AI

Colab Proとローカルマシンでどのくらい差が出るか簡単にベンチマークしてみたのでその結果です。

レンダリング条件

今回は以下の設定で回した結果を比較します。前回と同じです。

設定画面

ColabProでのNotebookは以下を使いました。

https://gist.github.com/Lycolia/cb432ad1b1ce083482b5487c131b5d12/80a059931c538b10d55cf9fcbf82220f24e64653

設定値は以下の通りです。

設定
Propmpt (illustration:1.0), masterpiece, best quality, 1girl, solo, happy, smile, theater, (perspective:1.3), from below, (looking away:1.2), (from side:1.0), {{shot_hair}}, smile, bangs, shaggy, (brown hair:1.1), swept_bangs, thick_eyebrows, skin_fang, closed mouth, {{purple eyes}}, gray {{jacket}}, white shirt, glasses, {{small breasts}},
Negative Prompt nsfw, (worst quality, low quality:1.4), (depth of field, blurry, bokeh:1.5), (greyscale, monochrome:1.0), multiple views, text, title, logo, signature, (tooth, lip, nose, 3d, realistic:1.0), dutch angle,(cropped:1.4), text, title, signature, logo, (loli:1.2), school satchel, pink, school bag, school uniform, from behind
Model AOM3A1B
VAE orangemix.vae.pt
Sampleing method Euler a
Sampleing steps 20
Width 512px
Height 512px
Batch count 1
Batch size 1
CFG Scale 7
Seed -1

ローカルマシンのスペック

Local 1

機材 内容 備考
OS Windows 11 Pro
M/B ASUS ROG STRIX Z390-F GAMING PCIe 3.0
CPU Intel Core i9-9900
GPU GeForce RTX 4070 Ti
MEM DDR4-3200 16GB * 4

Local 2

PCIeのバージョンを上げるとベンチスコアが伸びると聞いたので試してみた

機材 内容 備考
OS Windows 11 Pro
M/B ASUS TUF GAMING Z790-PLUS D4 PCIe 5.0
CPU Intel Core i7 13700
GPU GeForce RTX 4070 Ti
MEM DDR4-3200 16GB * 4

ベンチマーク結果

Colabは時間帯によって処理時間が変わるので2点計測しています。

4070 TiがColabProに大きく勝る結果となりました。UIの安定性や応答性でも体感ColabProを大きく上回り、ローカルストレージに出力結果や環境を溜め込み続けられる利便性があったり、起動速度に雲泥の差があったり、設定を記憶できたり、ローカルで動かせるならそれが一番楽だと感じました。

Colab Proは4:30と23:00に計測しています

グラボはZOTAC GAMING GeForce RTX 4070 Ti Trinity OCを使っていますが、発熱も60度くらいに収まるのでぼちぼち悪くないかなと思ってます。

おまけ

今回もベンチマーク中に生成された画像を何枚かピックアップして載せておきます

00001-1302401151.png

おまけ2

ローカルだと気楽に作れるのでサッと作ってみた高品質版

設定値は以下の通りです。

設定画面

設定
Propmpt (masterpiece, sidelighting, finely detailed beautiful eyes: 1.2), masterpiece*portrait, realistic, 3d face, glowing eyes, shiny hair, lustrous skin, (brown hair:1.1), short hair, smile, 1girl, embarassed, small breasts, theater, thick eyebrows, closed mouth, {{purple eyes}}, gray {{jacket}}, {{{{white shirt}}}}, glasses, {{small breasts}
Negative Prompt {{{{{{{nsfw}}}}}}, (worst quality, low quality:1.4), (depth of field, blurry, bokeh:1.5), (greyscale, monochrome:1.0), multiple views, text, title, logo, signature, (tooth, lip, nose, 3d, realistic:1.0), dutch angle,(cropped:1.4), text, title, signature, logo, (loli:1.2), school satchel, pink, school bag, school uniform, from behind
Model AOM3A1B
VAE orangemix.vae.pt
Sampleing steps 32
Sampleing method DPM++ SDE Karras
CFG Scale 7
Width 512px
Height 756px
Clip skip 2
Seed -1

2023-05-04現在、無料枠では利用できない可能性があります。

Google ColaboratoryでStable Diffusionを動かす場合、無料と有料でどの程度変わるのか試してみたのでその結果。ざっくり4倍ほど変わるのかなというのが体感です。

レンダリング条件

今回は以下の設定で回した結果を比較します。

WebUIの設定スクショ

ベースとなるNotebookは以下を使っています。

https://gist.github.com/Lycolia/cb432ad1b1ce083482b5487c131b5d12/80a059931c538b10d55cf9fcbf82220f24e64653

設定値は以下です。ほぼデフォです。

設定
Propmpt (illustration:1.0), masterpiece, best quality, 1girl, solo, happy, smile, theater, (perspective:1.3), from below, (looking away:1.2), (from side:1.0), {{shot_hair}}, smile, bangs, shaggy, (brown hair:1.1), swept_bangs, thick_eyebrows, skin_fang, closed mouth, {{purple eyes}}, gray {{jacket}}, white shirt, glasses, {{small breasts}},
Negative Prompt nsfw, (worst quality, low quality:1.4), (depth of field, blurry, bokeh:1.5), (greyscale, monochrome:1.0), multiple views, text, title, logo, signature, (tooth, lip, nose, 3d, realistic:1.0), dutch angle,(cropped:1.4), text, title, signature, logo, (loli:1.2), school satchel, pink, school bag, school uniform, from behind
Model AOM3A1B
VAE orangemix.vae.pt
Sampleing method Euler a
Sampleing steps 20
Width 512px
Height 512px
Batch count 1
Batch size 1
CFG Scale 7
Seed -1

比較結果

レンダリング時間はTotal progressの時間を書いてます。

\ Colab無料枠 Colab Pro
GPUクラス 標準 プレミアム
メモリ 標準 ハイメモリ
GPU Tesla T4 A100
システムRAM 12.7 GB 83.5 GB
GPU RAM 15.0 GB 40.0GB
ディスク 166.8 GB 166.8 GB
レンダリング時間 8秒 2秒

セットアップ時間はどちらも5分ほど。

スペック情報参考

無料枠

Golab Proで標準GPUにしても同じです。

Tue Apr 11 12:50:30 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.85.12    Driver Version: 525.85.12    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla T4            Off  | 00000000:00:04.0 Off |                    0 |
| N/A   70C    P8    33W /  70W |      0MiB / 15360MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
              total        used        free      shared  buff/cache   available
Mem:           12Gi       628Mi       7.4Gi       5.0Mi       4.6Gi        11Gi
Swap:            0B          0B          0B

Colab Pro

Pay As You Goで有料枠買ってもGPUは同じです。

Tue Apr 11 12:55:03 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.85.12    Driver Version: 525.85.12    CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA A100-SXM...  Off  | 00000000:00:04.0 Off |                    0 |
| N/A   39C    P0    46W / 400W |      0MiB / 40960MiB |      0%      Default |
|                               |                      |             Disabled |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
              total        used        free      shared  buff/cache   available
Mem:           83Gi       756Mi        79Gi       1.0Mi       3.3Gi        82Gi
Swap:            0B          0B          0B

おまけの成果物

そこそこちゃんとした絵は頑張ってプロンプト練ったり、ひたすら回したり、i2iを繰り返したりしないと、やっぱ出てこないですね。まぁモデルによっては楽に出せたりしますが、権利関係が怪しかったりするのでここには出せないです…w

あとがき

時間帯によってUIが異様に重くなることがあり、GPUの処理速度も時間帯によっては1秒未満で終わることがあった気もするので、この不安定さはクラウドユースの欠点だなぁと思いました。とは言え、GPUを買うことに比べれば手軽に利用できるのは、やはりメリットかなと思います。

よく使う人はグラボ買ったほうがストレスとかから開放される可能性はあるかもしれません。私はRTX2060なのでどう転んでもColabの方がマシなのが悲しいところ…。4070Ti買うか地味に迷いますね。