about summary refs log tree commit diff
path: root/bundles/vast-base/items.py
blob: 5d705a9389e05b6503e7259d9314ea699bb2d864 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from shlex import quote

if node.os != "debian":
    raise BundleError(f"{node.name}: OS {node.os} is not supported.")


files = {
    "/workspace/storage/stable_diffusion/models/ckpt/v1-5-pruned-emaonly.ckpt": {
        "delete": True,
    },

}

# ranbooru_dir = "/workspace/stable-diffusion-webui/extensions/sd-webui-ranbooru"
# ranbooru_url = "https://github.com/Inzaniak/sd-webui-ranbooru/archive/master.tar.gz"
#
# actions = {
#     "download_ranbooru": {
#         "command": f"aria2c -o /workspace/master.tgz {quote(ranbooru_url)} && tar xf /workspace/master.tgz --strip-components=1 {quote(ranbooru_dir)}; rm -rf /workspace/master.tgz;",
#         "needs": {"pkg_apt:aria2"},
#         "unless": f"test -d {ranbooru_dir}/README.md",
#     },
# }
#
modeldir = node.metadata.get("vast/model-dir", "/tmp/")
for url, opts in node.metadata.get("vast/models", {}).items():
    print('???', opts)
    actions["download_" + opts["filename"]] = {
        "command": f"aria2c -d {quote(modeldir)} {quote(url)}{f"?token={repo.vault.cmd("rbw get civitai/apikey")}" if "civitai.com" in url else ""}",
        "needs": {"pkg_apt:aria2"},
        "unless": f"printf '{opts["sha256"]}  {modeldir}/{opts["filename"]}' | sha256sum -c -",
    }