vast-ai-provisioner 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,16 +2,36 @@
2
2
 
3
3
  This script will provision a [Vast.ai](https://vast.ai) instance with a specific template which can be overridden and customized beyond what is available with Vast's template system. The repo currently provides the following templates:
4
4
 
5
- - "Complete" ComfyUI install - Flux, WAN, Hunyuan, SDXL + variants, ControlNets, and LoRAs
6
- - SDXL ComfyUI install - all of the above minus Flux, WAN, and Hunyuan
7
- - Flux Kontext ComfyUI install - Just Flux Kontext
5
+ - [ComfyUI](https://github.com/comfyanonymous/ComfyUI) - A node-based AI image/video generation suite
8
6
  - [FP-Studio](https://github.com/FP-Studio/FramePack-Studio) - A FramePack-based video editor
9
7
 
10
- # Requirements
8
+ Additionally, there are several modules available to add to the base ComfyUI install:
9
+
10
+ - Animagine: Animagine XL 4.0, a best-in-class anime model
11
+ - Flux Dev: Adds Flux 1.Dev and ControlNet
12
+ - Flux Kontext: Adds Flux Kontext for image editing
13
+ - Pixel Art: Adds Pixel Art LoRAs for SDXL
14
+ - SDXL: Adds SDXL and ControlNet
15
+ - Upscalers: A collection of high quality 2x and 4x upscalers
16
+ - Utility Nodes: A set of Comfy nodes to make building workflows easier
17
+ - WAN2.2: A powerful text-to-video or image-to-video model
18
+
19
+ ## Requirements
11
20
 
12
21
  - Node >=22
13
22
 
14
- # Usage
23
+ ## Usage
24
+
25
+ ```sh
26
+ npm install -g vast-ai-provisioner
27
+ vast-ai-provisioner -h
28
+
29
+ OR
30
+
31
+ npx vast-ai-provisioner -h
32
+ ```
33
+
34
+ ## Development
15
35
 
16
36
  ```sh
17
37
  corepack enable
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "Animagine XL 4.0",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "checkpoint_models": [
7
+ "https://huggingface.co/cagliostrolab/animagine-xl-4.0/resolve/main/animagine-xl-4.0.safetensors"
8
+ ],
9
+ "workflows": [
10
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/animagine-4.json"
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "Flux 1.D",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "clip_models": [
7
+ "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors"
8
+ ],
9
+ "controlnet_models": [
10
+ "https://huggingface.co/XLabs-AI/flux-ip-adapter/resolve/main/ip_adapter.safetensors"
11
+ ],
12
+ "diffusion_models": [
13
+ "https://huggingface.co/Kijai/flux-fp8/resolve/main/flux1-dev-fp8-e4m3fn.safetensors"
14
+ ],
15
+ "text_encoder_models": [
16
+ "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors"
17
+ ],
18
+ "vae_models": [
19
+ "https://huggingface.co/ffxvs/vae-flux/resolve/main/ae.safetensors"
20
+ ],
21
+ "workflows": [
22
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/flux-txt2img.json"
23
+ ]
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "Flux Kontext",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "clip_models": [
7
+ "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors"
8
+ ],
9
+ "diffusion_models": [
10
+ "https://huggingface.co/Comfy-Org/flux1-kontext-dev_ComfyUI/resolve/main/split_files/diffusion_models/flux1-dev-kontext_fp8_scaled.safetensors"
11
+ ],
12
+ "text_encoder_models": [
13
+ "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors"
14
+ ],
15
+ "vae_models": [
16
+ "https://huggingface.co/ffxvs/vae-flux/resolve/main/ae.safetensors"
17
+ ],
18
+ "workflows": [
19
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/flux-kontext.json"
20
+ ]
21
+ }
22
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "Pixel Art Resources",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "checkpoint_models": [
7
+ "https://huggingface.co/AIWorksMD/pixelArtDiffusionXL/resolve/main/pixelArtDiffusionXL_spriteShaper.safetensors"
8
+ ],
9
+ "lora_models": [
10
+ "https://civitai.com/api/download/models/135931?type=Model&format=SafeTensor"
11
+ ]
12
+ }
13
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "SDXL",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "checkpoint_models": [
7
+ "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
8
+ ],
9
+ "controlnet_models": [
10
+ "https://huggingface.co/brad-twinkl/controlnet-union-sdxl-1.0-promax/resolve/main/diffusion_pytorch_model.safetensors"
11
+ ],
12
+ "workflows": [
13
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/sdxl-controlnet.json",
14
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/sdxl-img2img.json",
15
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/sdxl-txt2img.json"
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "Popular Upscalers",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "esrgan_models": [
7
+ "https://github.com/Phhofm/models/releases/download/4xNomos2_hq_dat2/4xNomos2_hq_dat2.pth",
8
+ "https://github.com/Kim2091/Kim2091-Models/releases/download/2x-AnimeSharpV4/2x-AnimeSharpV4_RCAN.safetensors",
9
+ "https://github.com/Kim2091/Kim2091-Models/releases/download/2x-AnimeSharpV2_Set/2x-AnimeSharpV2_RPLKSR_Sharp.pth",
10
+ "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth",
11
+ "https://drive.usercontent.google.com/download?id=19Kn6-avBPXhEjp9Hj2OkMzozo7T9C-6j&export=download&authuser=0&confirm=t&uuid=4ae5a096-cbf8-4db0-8a76-f20313ac67eb&at=AN8xHop2wzdHQMGBO9N3W_S9bNX8:1754245171054"
12
+ ],
13
+ "workflows": [
14
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/remove-bg.json",
15
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/upscaler.json"
16
+ ]
17
+ }
18
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "Utility Node Pack",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "nodes": [
7
+ "https://github.com/kijai/ComfyUI-KJNodes",
8
+ "https://github.com/ltdrdata/ComfyUI-Manager",
9
+ "https://github.com/ltdrdata/was-node-suite-comfyui",
10
+ "https://github.com/ZHO-ZHO-ZHO/ComfyUI-BRIA_AI-RMBG",
11
+ "https://github.com/Fannovel16/comfyui_controlnet_aux"
12
+ ]
13
+ }
14
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/module.schema.json",
3
+ "name": "WAN2.2",
4
+ "template": "ComfyUI",
5
+ "files": {
6
+ "nodes": ["https://github.com/city96/ComfyUI-GGUF"],
7
+ "workflows": [
8
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/wan2.2-img2vid.json"
9
+ ],
10
+ "vae_models": [
11
+ "https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan2.2_vae.safetensors"
12
+ ],
13
+ "text_encoder_models": [
14
+ "https://huggingface.co/city96/umt5-xxl-encoder-gguf/resolve/main/umt5-xxl-encoder-Q5_K_M.gguf"
15
+ ],
16
+ "diffusion_models": [
17
+ "https://huggingface.co/QuantStack/Wan2.2-TI2V-5B-GGUF/resolve/main/Wan2.2-TI2V-5B-Q5_K_M.gguf"
18
+ ]
19
+ }
20
+ }
package/package.json CHANGED
@@ -58,7 +58,10 @@
58
58
  "node": ">=22"
59
59
  },
60
60
  "files": [
61
- "lib/"
61
+ "lib/",
62
+ "modules/",
63
+ "templates/",
64
+ "scripts/"
62
65
  ],
63
66
  "homepage": "https://github.com/ayan4m1/vast-ai-provisioner#readme",
64
67
  "license": "MIT",
@@ -79,5 +82,5 @@
79
82
  },
80
83
  "type": "module",
81
84
  "types": "lib/index.d.ts",
82
- "version": "1.0.0"
85
+ "version": "1.0.1"
83
86
  }
@@ -0,0 +1,215 @@
1
+ #!/bin/bash
2
+
3
+ source /venv/main/bin/activate
4
+ COMFYUI_DIR=${WORKSPACE}/ComfyUI
5
+
6
+ # Packages are installed after nodes so we can fix them...
7
+
8
+ APT_PACKAGES=(
9
+ {{ APT_PACKAGES }}
10
+ )
11
+
12
+ PIP_PACKAGES=(
13
+ {{ PIP_PACKAGES }}
14
+ )
15
+
16
+ NODES=(
17
+ {{ NODES }}
18
+ )
19
+
20
+ WORKFLOWS=(
21
+ {{ WORKFLOWS }}
22
+ )
23
+
24
+ CLIP_MODELS=(
25
+ {{ CLIP_MODELS }}
26
+ )
27
+
28
+ CLIP_VISION_MODELS=(
29
+ {{ CLIP_VISION_MODELS }}
30
+ )
31
+
32
+ CHECKPOINT_MODELS=(
33
+ {{ CHECKPOINT_MODELS }}
34
+ )
35
+
36
+ UNET_MODELS=(
37
+ {{ UNET_MODELS }}
38
+ )
39
+
40
+ LORA_MODELS=(
41
+ {{ LORA_MODELS }}
42
+ )
43
+
44
+ VAE_MODELS=(
45
+ {{ VAE_MODELS }}
46
+ )
47
+
48
+ ESRGAN_MODELS=(
49
+ {{ ESRGAN_MODELS }}
50
+ )
51
+
52
+ CONTROLNET_MODELS=(
53
+ {{ CONTROLNET_MODELS }}
54
+ )
55
+
56
+ TEXT_ENCODER_MODELS=(
57
+ {{ TEXT_ENCODER_MODELS }}
58
+ )
59
+
60
+ DIFFUSION_MODELS=(
61
+ {{ DIFFUSION_MODELS }}
62
+ )
63
+
64
+ ### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
65
+
66
+ function provisioning_start() {
67
+ provisioning_print_header
68
+ provisioning_get_apt_packages
69
+ provisioning_get_nodes
70
+ provisioning_get_pip_packages
71
+ provisioning_get_files \
72
+ "${COMFYUI_DIR}/models/clip" \
73
+ "${CLIP_MODELS[@]}"
74
+ provisioning_get_files \
75
+ "${COMFYUI_DIR}/models/clip_vision" \
76
+ "${CLIP_VISION_MODELS[@]}"
77
+ provisioning_get_files \
78
+ "${COMFYUI_DIR}/models/checkpoints" \
79
+ "${CHECKPOINT_MODELS[@]}"
80
+ provisioning_get_files \
81
+ "${COMFYUI_DIR}/models/unet" \
82
+ "${UNET_MODELS[@]}"
83
+ provisioning_get_files \
84
+ "${COMFYUI_DIR}/models/text_encoders" \
85
+ "${TEXT_ENCODER_MODELS[@]}"
86
+ provisioning_get_files \
87
+ "${COMFYUI_DIR}/models/diffusion_models" \
88
+ "${DIFFUSION_MODELS[@]}"
89
+ provisioning_get_files \
90
+ "${COMFYUI_DIR}/models/lora" \
91
+ "${LORA_MODELS[@]}"
92
+ provisioning_get_files \
93
+ "${COMFYUI_DIR}/models/controlnet" \
94
+ "${CONTROLNET_MODELS[@]}"
95
+ provisioning_get_files \
96
+ "${COMFYUI_DIR}/models/vae" \
97
+ "${VAE_MODELS[@]}"
98
+ provisioning_get_files \
99
+ "${COMFYUI_DIR}/models/esrgan" \
100
+ "${ESRGAN_MODELS[@]}"
101
+ provisioning_get_files \
102
+ "${COMFYUI_DIR}/user/default/workflows" \
103
+ "${WORKFLOWS[@]}"
104
+ provisioning_print_end
105
+ }
106
+
107
+ function provisioning_get_apt_packages() {
108
+ if [[ -n $APT_PACKAGES ]]; then
109
+ sudo $APT_INSTALL ${APT_PACKAGES[@]}
110
+ fi
111
+ }
112
+
113
+ function provisioning_get_pip_packages() {
114
+ if [[ -n $PIP_PACKAGES ]]; then
115
+ pip install --no-cache-dir ${PIP_PACKAGES[@]}
116
+ fi
117
+ }
118
+
119
+ function provisioning_get_nodes() {
120
+ for repo in "${NODES[@]}"; do
121
+ dir="${repo##*/}"
122
+ path="${COMFYUI_DIR}/custom_nodes/${dir}"
123
+ requirements="${path}/requirements.txt"
124
+ if [[ -d $path ]]; then
125
+ if [[ ${AUTO_UPDATE,,} != "false" ]]; then
126
+ printf "Updating node: %s...\n" "${repo}"
127
+ ( cd "$path" && git pull )
128
+ if [[ -e $requirements ]]; then
129
+ pip install --no-cache-dir -r "$requirements"
130
+ fi
131
+ fi
132
+ else
133
+ printf "Downloading node: %s...\n" "${repo}"
134
+ git clone "${repo}" "${path}" --recursive
135
+ if [[ -e $requirements ]]; then
136
+ pip install --no-cache-dir -r "${requirements}"
137
+ fi
138
+ fi
139
+ done
140
+ }
141
+
142
+ function provisioning_get_files() {
143
+ if [[ -z $2 ]]; then return 1; fi
144
+
145
+ dir="$1"
146
+ mkdir -p "$dir"
147
+ shift
148
+ arr=("$@")
149
+ printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir"
150
+ for url in "${arr[@]}"; do
151
+ printf "Downloading: %s\n" "${url}"
152
+ provisioning_download "${url}" "${dir}"
153
+ printf "\n"
154
+ done
155
+ }
156
+
157
+ function provisioning_print_header() {
158
+ printf "\n##############################################\n# #\n# Provisioning container #\n# #\n# This will take some time #\n# #\n# Your container will be ready on completion #\n# #\n##############################################\n\n"
159
+ }
160
+
161
+ function provisioning_print_end() {
162
+ printf "\nProvisioning complete: Application will start now\n\n"
163
+ }
164
+
165
+ function provisioning_has_valid_hf_token() {
166
+ [[ -n "$HF_TOKEN" ]] || return 1
167
+ url="https://huggingface.co/api/whoami-v2"
168
+
169
+ response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
170
+ -H "Authorization: Bearer $HF_TOKEN" \
171
+ -H "Content-Type: application/json")
172
+
173
+ # Check if the token is valid
174
+ if [ "$response" -eq 200 ]; then
175
+ return 0
176
+ else
177
+ return 1
178
+ fi
179
+ }
180
+
181
+ function provisioning_has_valid_civitai_token() {
182
+ [[ -n "$CIVITAI_TOKEN" ]] || return 1
183
+ url="https://civitai.com/api/v1/models?hidden=1&limit=1"
184
+
185
+ response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
186
+ -H "Authorization: Bearer $CIVITAI_TOKEN" \
187
+ -H "Content-Type: application/json")
188
+
189
+ # Check if the token is valid
190
+ if [ "$response" -eq 200 ]; then
191
+ return 0
192
+ else
193
+ return 1
194
+ fi
195
+ }
196
+
197
+ # Download from $1 URL to $2 file path
198
+ function provisioning_download() {
199
+ if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then
200
+ auth_token="$HF_TOKEN"
201
+ elif
202
+ [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then
203
+ auth_token="$CIVITAI_TOKEN"
204
+ fi
205
+ if [[ -n $auth_token ]];then
206
+ wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
207
+ else
208
+ wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
209
+ fi
210
+ }
211
+
212
+ # Allow user to disable provisioning if they started with a script they didn't want
213
+ if [[ ! -f /.noprovisioning ]]; then
214
+ provisioning_start
215
+ fi
@@ -0,0 +1,201 @@
1
+ #!/bin/bash
2
+
3
+ source /venv/main/bin/activate
4
+ COMFYUI_DIR=${WORKSPACE}/ComfyUI
5
+
6
+ # Packages are installed after nodes so we can fix them...
7
+
8
+ APT_PACKAGES=()
9
+
10
+ PIP_PACKAGES=(
11
+ "xformers"
12
+ )
13
+
14
+ NODES=(
15
+ "https://github.com/ltdrdata/ComfyUI-Manager"
16
+ )
17
+
18
+ WORKFLOWS=(
19
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/flux-kontext.json"
20
+ )
21
+
22
+ CLIP_MODELS=(
23
+ "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors"
24
+ )
25
+
26
+ CHECKPOINT_MODELS=()
27
+
28
+ UNET_MODELS=()
29
+
30
+ LORA_MODELS=()
31
+
32
+ VAE_MODELS=(
33
+ "https://huggingface.co/ffxvs/vae-flux/resolve/main/ae.safetensors"
34
+ )
35
+
36
+ ESRGAN_MODELS=(
37
+ "https://github.com/Phhofm/models/releases/download/4xNomos2_hq_dat2/4xNomos2_hq_dat2.pth"
38
+ "https://github.com/Kim2091/Kim2091-Models/releases/download/2x-AnimeSharpV4/2x-AnimeSharpV4_RCAN.safetensors"
39
+ "https://github.com/Kim2091/Kim2091-Models/releases/download/2x-AnimeSharpV2_Set/2x-AnimeSharpV2_RPLKSR_Sharp.pth"
40
+ "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth"
41
+ )
42
+
43
+ CONTROLNET_MODELS=()
44
+
45
+ TEXT_ENCODER_MODELS=(
46
+ "https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors"
47
+ )
48
+
49
+ DIFFUSION_MODELS=(
50
+ "https://huggingface.co/Comfy-Org/flux1-kontext-dev_ComfyUI/resolve/main/split_files/diffusion_models/flux1-dev-kontext_fp8_scaled.safetensors"
51
+ )
52
+
53
+ ### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
54
+
55
+ function provisioning_start() {
56
+ provisioning_print_header
57
+ provisioning_get_apt_packages
58
+ provisioning_get_nodes
59
+ provisioning_get_pip_packages
60
+ provisioning_get_files \
61
+ "${COMFYUI_DIR}/models/clip" \
62
+ "${CLIP_MODELS[@]}"
63
+ provisioning_get_files \
64
+ "${COMFYUI_DIR}/models/checkpoints" \
65
+ "${CHECKPOINT_MODELS[@]}"
66
+ provisioning_get_files \
67
+ "${COMFYUI_DIR}/models/unet" \
68
+ "${UNET_MODELS[@]}"
69
+ provisioning_get_files \
70
+ "${COMFYUI_DIR}/models/text_encoders" \
71
+ "${TEXT_ENCODER_MODELS[@]}"
72
+ provisioning_get_files \
73
+ "${COMFYUI_DIR}/models/diffusion_models" \
74
+ "${DIFFUSION_MODELS[@]}"
75
+ provisioning_get_files \
76
+ "${COMFYUI_DIR}/models/lora" \
77
+ "${LORA_MODELS[@]}"
78
+ provisioning_get_files \
79
+ "${COMFYUI_DIR}/models/controlnet" \
80
+ "${CONTROLNET_MODELS[@]}"
81
+ provisioning_get_files \
82
+ "${COMFYUI_DIR}/models/vae" \
83
+ "${VAE_MODELS[@]}"
84
+ provisioning_get_files \
85
+ "${COMFYUI_DIR}/models/esrgan" \
86
+ "${ESRGAN_MODELS[@]}"
87
+ provisioning_get_files \
88
+ "${COMFYUI_DIR}/user/default/workflows" \
89
+ "${WORKFLOWS[@]}"
90
+ provisioning_print_end
91
+ }
92
+
93
+ function provisioning_get_apt_packages() {
94
+ if [[ -n $APT_PACKAGES ]]; then
95
+ sudo $APT_INSTALL ${APT_PACKAGES[@]}
96
+ fi
97
+ }
98
+
99
+ function provisioning_get_pip_packages() {
100
+ if [[ -n $PIP_PACKAGES ]]; then
101
+ pip install --no-cache-dir ${PIP_PACKAGES[@]}
102
+ fi
103
+ }
104
+
105
+ function provisioning_get_nodes() {
106
+ for repo in "${NODES[@]}"; do
107
+ dir="${repo##*/}"
108
+ path="${COMFYUI_DIR}/custom_nodes/${dir}"
109
+ requirements="${path}/requirements.txt"
110
+ if [[ -d $path ]]; then
111
+ if [[ ${AUTO_UPDATE,,} != "false" ]]; then
112
+ printf "Updating node: %s...\n" "${repo}"
113
+ ( cd "$path" && git pull )
114
+ if [[ -e $requirements ]]; then
115
+ pip install --no-cache-dir -r "$requirements"
116
+ fi
117
+ fi
118
+ else
119
+ printf "Downloading node: %s...\n" "${repo}"
120
+ git clone "${repo}" "${path}" --recursive
121
+ if [[ -e $requirements ]]; then
122
+ pip install --no-cache-dir -r "${requirements}"
123
+ fi
124
+ fi
125
+ done
126
+ }
127
+
128
+ function provisioning_get_files() {
129
+ if [[ -z $2 ]]; then return 1; fi
130
+
131
+ dir="$1"
132
+ mkdir -p "$dir"
133
+ shift
134
+ arr=("$@")
135
+ printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir"
136
+ for url in "${arr[@]}"; do
137
+ printf "Downloading: %s\n" "${url}"
138
+ provisioning_download "${url}" "${dir}"
139
+ printf "\n"
140
+ done
141
+ }
142
+
143
+ function provisioning_print_header() {
144
+ printf "\n##############################################\n# #\n# Provisioning container #\n# #\n# This will take some time #\n# #\n# Your container will be ready on completion #\n# #\n##############################################\n\n"
145
+ }
146
+
147
+ function provisioning_print_end() {
148
+ printf "\nProvisioning complete: Application will start now\n\n"
149
+ }
150
+
151
+ function provisioning_has_valid_hf_token() {
152
+ [[ -n "$HF_TOKEN" ]] || return 1
153
+ url="https://huggingface.co/api/whoami-v2"
154
+
155
+ response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
156
+ -H "Authorization: Bearer $HF_TOKEN" \
157
+ -H "Content-Type: application/json")
158
+
159
+ # Check if the token is valid
160
+ if [ "$response" -eq 200 ]; then
161
+ return 0
162
+ else
163
+ return 1
164
+ fi
165
+ }
166
+
167
+ function provisioning_has_valid_civitai_token() {
168
+ [[ -n "$CIVITAI_TOKEN" ]] || return 1
169
+ url="https://civitai.com/api/v1/models?hidden=1&limit=1"
170
+
171
+ response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
172
+ -H "Authorization: Bearer $CIVITAI_TOKEN" \
173
+ -H "Content-Type: application/json")
174
+
175
+ # Check if the token is valid
176
+ if [ "$response" -eq 200 ]; then
177
+ return 0
178
+ else
179
+ return 1
180
+ fi
181
+ }
182
+
183
+ # Download from $1 URL to $2 file path
184
+ function provisioning_download() {
185
+ if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then
186
+ auth_token="$HF_TOKEN"
187
+ elif
188
+ [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then
189
+ auth_token="$CIVITAI_TOKEN"
190
+ fi
191
+ if [[ -n $auth_token ]];then
192
+ wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
193
+ else
194
+ wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
195
+ fi
196
+ }
197
+
198
+ # Allow user to disable provisioning if they started with a script they didn't want
199
+ if [[ ! -f /.noprovisioning ]]; then
200
+ provisioning_start
201
+ fi
package/scripts/wan.sh ADDED
@@ -0,0 +1,213 @@
1
+ #!/bin/bash
2
+
3
+ source /venv/main/bin/activate
4
+ COMFYUI_DIR=${WORKSPACE}/ComfyUI
5
+
6
+ # Packages are installed after nodes so we can fix them...
7
+
8
+ APT_PACKAGES=()
9
+
10
+ PIP_PACKAGES=(
11
+ "xformers"
12
+ )
13
+
14
+ NODES=(
15
+ "https://github.com/ltdrdata/ComfyUI-Manager"
16
+ "https://github.com/city96/ComfyUI-GGUF"
17
+ "https://github.com/kijai/ComfyUI-KJNodes"
18
+ "https://github.com/ltdrdata/was-node-suite-comfyui"
19
+ "https://github.com/kijai/ComfyUI-HunyuanVideoWrapper"
20
+ "https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite"
21
+ )
22
+
23
+ WORKFLOWS=(
24
+ "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/workflows/wan2.2-img2vid.json"
25
+ )
26
+
27
+ CLIP_MODELS=()
28
+
29
+ CLIP_VISION_MODELS=()
30
+
31
+ CHECKPOINT_MODELS=()
32
+
33
+ UNET_MODELS=()
34
+
35
+ LORA_MODELS=()
36
+
37
+ VAE_MODELS=(
38
+ # "https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors"
39
+ "https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan2.2_vae.safetensors"
40
+ )
41
+
42
+ ESRGAN_MODELS=(
43
+ "https://github.com/Phhofm/models/releases/download/4xNomos2_hq_dat2/4xNomos2_hq_dat2.pth"
44
+ "https://github.com/Kim2091/Kim2091-Models/releases/download/2x-AnimeSharpV4/2x-AnimeSharpV4_RCAN.safetensors"
45
+ "https://github.com/Kim2091/Kim2091-Models/releases/download/2x-AnimeSharpV2_Set/2x-AnimeSharpV2_RPLKSR_Sharp.pth"
46
+ "https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth"
47
+ )
48
+
49
+ CONTROLNET_MODELS=()
50
+
51
+ TEXT_ENCODER_MODELS=(
52
+ # "https://huggingface.co/calcuis/wan-gguf/resolve/main/t5xxl_um_fp8_e4m3fn_scaled.safetensors"
53
+ "https://huggingface.co/city96/umt5-xxl-encoder-gguf/resolve/main/umt5-xxl-encoder-Q5_K_M.gguf"
54
+
55
+ )
56
+
57
+ DIFFUSION_MODELS=(
58
+ # "https://huggingface.co/city96/Wan2.1-I2V-14B-480P-gguf/resolve/main/wan2.1-i2v-14b-480p-Q5_K_M.gguf"
59
+ "https://huggingface.co/QuantStack/Wan2.2-TI2V-5B-GGUF/resolve/main/Wan2.2-TI2V-5B-Q5_K_M.gguf"
60
+ )
61
+
62
+ ### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
63
+
64
+ function provisioning_start() {
65
+ provisioning_print_header
66
+ provisioning_get_apt_packages
67
+ provisioning_get_nodes
68
+ provisioning_get_pip_packages
69
+ provisioning_get_files \
70
+ "${COMFYUI_DIR}/models/clip" \
71
+ "${CLIP_MODELS[@]}"
72
+ provisioning_get_files \
73
+ "${COMFYUI_DIR}/models/clip_vision" \
74
+ "${CLIP_VISION_MODELS[@]}"
75
+ provisioning_get_files \
76
+ "${COMFYUI_DIR}/models/checkpoints" \
77
+ "${CHECKPOINT_MODELS[@]}"
78
+ provisioning_get_files \
79
+ "${COMFYUI_DIR}/models/unet" \
80
+ "${UNET_MODELS[@]}"
81
+ provisioning_get_files \
82
+ "${COMFYUI_DIR}/models/text_encoders" \
83
+ "${TEXT_ENCODER_MODELS[@]}"
84
+ provisioning_get_files \
85
+ "${COMFYUI_DIR}/models/diffusion_models" \
86
+ "${DIFFUSION_MODELS[@]}"
87
+ provisioning_get_files \
88
+ "${COMFYUI_DIR}/models/lora" \
89
+ "${LORA_MODELS[@]}"
90
+ provisioning_get_files \
91
+ "${COMFYUI_DIR}/models/controlnet" \
92
+ "${CONTROLNET_MODELS[@]}"
93
+ provisioning_get_files \
94
+ "${COMFYUI_DIR}/models/vae" \
95
+ "${VAE_MODELS[@]}"
96
+ provisioning_get_files \
97
+ "${COMFYUI_DIR}/models/esrgan" \
98
+ "${ESRGAN_MODELS[@]}"
99
+ provisioning_get_files \
100
+ "${COMFYUI_DIR}/user/default/workflows" \
101
+ "${WORKFLOWS[@]}"
102
+ provisioning_print_end
103
+ }
104
+
105
+ function provisioning_get_apt_packages() {
106
+ if [[ -n $APT_PACKAGES ]]; then
107
+ sudo $APT_INSTALL ${APT_PACKAGES[@]}
108
+ fi
109
+ }
110
+
111
+ function provisioning_get_pip_packages() {
112
+ if [[ -n $PIP_PACKAGES ]]; then
113
+ pip install --no-cache-dir ${PIP_PACKAGES[@]}
114
+ fi
115
+ }
116
+
117
+ function provisioning_get_nodes() {
118
+ for repo in "${NODES[@]}"; do
119
+ dir="${repo##*/}"
120
+ path="${COMFYUI_DIR}/custom_nodes/${dir}"
121
+ requirements="${path}/requirements.txt"
122
+ if [[ -d $path ]]; then
123
+ if [[ ${AUTO_UPDATE,,} != "false" ]]; then
124
+ printf "Updating node: %s...\n" "${repo}"
125
+ ( cd "$path" && git pull )
126
+ if [[ -e $requirements ]]; then
127
+ pip install --no-cache-dir -r "$requirements"
128
+ fi
129
+ fi
130
+ else
131
+ printf "Downloading node: %s...\n" "${repo}"
132
+ git clone "${repo}" "${path}" --recursive
133
+ if [[ -e $requirements ]]; then
134
+ pip install --no-cache-dir -r "${requirements}"
135
+ fi
136
+ fi
137
+ done
138
+ }
139
+
140
+ function provisioning_get_files() {
141
+ if [[ -z $2 ]]; then return 1; fi
142
+
143
+ dir="$1"
144
+ mkdir -p "$dir"
145
+ shift
146
+ arr=("$@")
147
+ printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir"
148
+ for url in "${arr[@]}"; do
149
+ printf "Downloading: %s\n" "${url}"
150
+ provisioning_download "${url}" "${dir}"
151
+ printf "\n"
152
+ done
153
+ }
154
+
155
+ function provisioning_print_header() {
156
+ printf "\n##############################################\n# #\n# Provisioning container #\n# #\n# This will take some time #\n# #\n# Your container will be ready on completion #\n# #\n##############################################\n\n"
157
+ }
158
+
159
+ function provisioning_print_end() {
160
+ printf "\nProvisioning complete: Application will start now\n\n"
161
+ }
162
+
163
+ function provisioning_has_valid_hf_token() {
164
+ [[ -n "$HF_TOKEN" ]] || return 1
165
+ url="https://huggingface.co/api/whoami-v2"
166
+
167
+ response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
168
+ -H "Authorization: Bearer $HF_TOKEN" \
169
+ -H "Content-Type: application/json")
170
+
171
+ # Check if the token is valid
172
+ if [ "$response" -eq 200 ]; then
173
+ return 0
174
+ else
175
+ return 1
176
+ fi
177
+ }
178
+
179
+ function provisioning_has_valid_civitai_token() {
180
+ [[ -n "$CIVITAI_TOKEN" ]] || return 1
181
+ url="https://civitai.com/api/v1/models?hidden=1&limit=1"
182
+
183
+ response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
184
+ -H "Authorization: Bearer $CIVITAI_TOKEN" \
185
+ -H "Content-Type: application/json")
186
+
187
+ # Check if the token is valid
188
+ if [ "$response" -eq 200 ]; then
189
+ return 0
190
+ else
191
+ return 1
192
+ fi
193
+ }
194
+
195
+ # Download from $1 URL to $2 file path
196
+ function provisioning_download() {
197
+ if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?huggingface\.co(/|$|\?) ]]; then
198
+ auth_token="$HF_TOKEN"
199
+ elif
200
+ [[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\.)?civitai\.com(/|$|\?) ]]; then
201
+ auth_token="$CIVITAI_TOKEN"
202
+ fi
203
+ if [[ -n $auth_token ]];then
204
+ wget --header="Authorization: Bearer $auth_token" -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
205
+ else
206
+ wget -qnc --content-disposition --show-progress -e dotbytes="${3:-4M}" -P "$2" "$1"
207
+ fi
208
+ }
209
+
210
+ # Allow user to disable provisioning if they started with a script they didn't want
211
+ if [[ ! -f /.noprovisioning ]]; then
212
+ provisioning_start
213
+ fi
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/template.schema.json",
3
+ "description": "A node-based AI image generator",
4
+ "environment": {
5
+ "OPEN_BUTTON_PORT": "1111",
6
+ "OPEN_BUTTON_TOKEN": "1",
7
+ "JUPYTER_DIR": "/",
8
+ "DATA_DIRECTORY": "/workspace/",
9
+ "PORTAL_CONFIG": "localhost:1111:11111:/:Instance Portal|localhost:8188:18188:/:ComfyUI|localhost:8080:18080:/:Jupyter|localhost:8080:8080:/terminals/1:Jupyter Terminal|localhost:8384:18384:/:Syncthing",
10
+ "COMFYUI_ARGS": "--disable-auto-launch --port 18188 --enable-cors-header"
11
+ },
12
+ "name": "ComfyUI",
13
+ "runType": "jupyter",
14
+ "script": "comfyui.sh",
15
+ "size": 8e9,
16
+ "tag": "vastai/comfy:cuda-12.8-auto",
17
+ "fileTypes": [
18
+ "apt_packages",
19
+ "pip_packages",
20
+ "nodes",
21
+ "workflows",
22
+ "clip_models",
23
+ "clip_vision_models",
24
+ "checkpoint_models",
25
+ "unet_models",
26
+ "lora_models",
27
+ "vae_models",
28
+ "esrgan_models",
29
+ "controlnet_models",
30
+ "text_encoder_models",
31
+ "diffusion_models"
32
+ ]
33
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/ayan4m1/vast-ai-provisioner/main/template.schema.json",
3
+ "description": "A FramePack video editor suite",
4
+ "name": "FP-Studio",
5
+ "size": 10e10,
6
+ "tag": "colinurbs/fp-studio:cuda12.8-latest-main",
7
+ "runType": "args"
8
+ }