Update krea.sh
Browse files
krea.sh
CHANGED
|
@@ -1,53 +1,18 @@
|
|
| 1 |
#!/bin/bash
|
| 2 |
# =============================================================================
|
| 3 |
-
# Krea 2 v1.5 — Provisioning (
|
| 4 |
-
#
|
| 5 |
-
#
|
| 6 |
#
|
| 7 |
-
# Variables d'environnement (
|
| 8 |
# CIVITAI_TOKEN (sinon la valeur en dur ci-dessous est utilisée)
|
| 9 |
# HF_TOKEN (optionnel)
|
| 10 |
-
# AUTO_UPDATE (optionnel, "false" pour ne pas mettre à jour ComfyUI / nodes)
|
| 11 |
# =============================================================================
|
| 12 |
|
| 13 |
source /venv/main/bin/activate
|
| 14 |
COMFYUI_DIR=${WORKSPACE}/ComfyUI
|
| 15 |
|
| 16 |
-
|
| 17 |
-
CIVITAI_TOKEN="${CIVITAI_TOKEN:-4ec3d116d2d1de7a3cf02563118d8c21}"
|
| 18 |
-
|
| 19 |
-
APT_PACKAGES=(
|
| 20 |
-
"tree"
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
PIP_PACKAGES=(
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
NODES=(
|
| 27 |
-
"https://github.com/ltdrdata/ComfyUI-Manager"
|
| 28 |
-
"https://github.com/rgthree/rgthree-comfy"
|
| 29 |
-
"https://github.com/ltdrdata/ComfyUI-Impact-Pack"
|
| 30 |
-
"https://github.com/ltdrdata/ComfyUI-Impact-Subpack"
|
| 31 |
-
"https://github.com/yolain/ComfyUI-Easy-Use"
|
| 32 |
-
"https://github.com/ssitu/ComfyUI_UltimateSDUpscale"
|
| 33 |
-
"https://github.com/sipherxyz/comfyui-art-venture"
|
| 34 |
-
"https://github.com/moonwhaler/comfyui-moonpack"
|
| 35 |
-
"https://github.com/gseth/ControlAltAI-Nodes"
|
| 36 |
-
"https://github.com/vrgamegirl19/comfyui-vrgamedevgirl"
|
| 37 |
-
"https://github.com/numz/ComfyUI-SeedVR2_VideoUpscaler"
|
| 38 |
-
"https://github.com/robertvoy/ComfyUI-Flux-Continuum"
|
| 39 |
-
"https://github.com/ltdrdata/was-node-suite-comfyui"
|
| 40 |
-
"https://github.com/ChangeTheConstants/SeedVarianceEnhancer"
|
| 41 |
-
"https://github.com/city96/ComfyUI-GGUF"
|
| 42 |
-
"https://github.com/kijai/ComfyUI-KJNodes"
|
| 43 |
-
"https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes"
|
| 44 |
-
"https://github.com/pythongosssss/ComfyUI-Custom-Scripts"
|
| 45 |
-
"https://github.com/sypex6/ComfyUI_InstaRAW_Nodes"
|
| 46 |
-
# --- Krea 2 ---
|
| 47 |
-
"https://github.com/facok/comfyui-krea2-controlnet"
|
| 48 |
-
"https://github.com/lbouaraba/comfyui-krea2edit"
|
| 49 |
-
"https://github.com/Fannovel16/comfyui_controlnet_aux"
|
| 50 |
-
)
|
| 51 |
|
| 52 |
# Workflows : uploade d'abord Krea2_v1.5.json dans ton repo HF nathanglm/sofia
|
| 53 |
WORKFLOWS=(
|
|
@@ -93,7 +58,6 @@ LORA_MODELS=(
|
|
| 93 |
"https://huggingface.co/nathanglm/sofia/resolve/main/model01.safetensors|model01.safetensors"
|
| 94 |
|
| 95 |
# --- SDXL (détailleurs SDXL du workflow Krea2 v1.5) ---
|
| 96 |
-
# Décommente si tu utilises les détailleurs SDXL, sinon bypass-les dans le workflow.
|
| 97 |
#"https://civitai.com/api/download/models/368603|SDXL-Detailed-Nipples-v1.safetensors"
|
| 98 |
#"https://civitai.com/api/download/models/712004|SDXL-Real-Pussy-Lotte.safetensors"
|
| 99 |
#"https://civitai.com/api/download/models/216946|SDXL-Penis-XL-v1.safetensors"
|
|
@@ -104,7 +68,6 @@ CHECKPOINT_MODELS=(
|
|
| 104 |
"https://civitai.com/api/download/models/1621447|sdxl-iniversemix.safetensors"
|
| 105 |
)
|
| 106 |
|
| 107 |
-
# GGUF : plus utilisé avec Krea 2 (le loader GGUF est en bypass dans le workflow)
|
| 108 |
UNET_MODELS=(
|
| 109 |
)
|
| 110 |
|
|
@@ -129,8 +92,6 @@ SEGM=(
|
|
| 129 |
"https://huggingface.co/Bingsu/adetailer/resolve/main/person_yolov8m-seg.pt"
|
| 130 |
)
|
| 131 |
|
| 132 |
-
# SeedVR2 et Depth Anything V2 : téléchargés automatiquement par leurs nodes au premier lancement.
|
| 133 |
-
|
| 134 |
ESRGAN_MODELS=(
|
| 135 |
)
|
| 136 |
|
|
@@ -140,13 +101,8 @@ CONTROLNET_MODELS=(
|
|
| 140 |
### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
|
| 141 |
|
| 142 |
function provisioning_start() {
|
| 143 |
-
|
| 144 |
provisioning_check_tokens
|
| 145 |
-
provisioning_get_apt_packages
|
| 146 |
-
provisioning_update_comfyui
|
| 147 |
-
provisioning_get_nodes
|
| 148 |
-
provisioning_get_pip_packages
|
| 149 |
-
provisioning_fix_flash_attn
|
| 150 |
provisioning_get_files "${COMFYUI_DIR}/models/diffusion_models" "${DIFFUSION_MODELS[@]}"
|
| 151 |
provisioning_get_files "${COMFYUI_DIR}/models/text_encoders" "${TEXT_ENCODERS[@]}"
|
| 152 |
provisioning_get_files "${COMFYUI_DIR}/models/vae" "${VAE_MODELS[@]}"
|
|
@@ -160,99 +116,32 @@ function provisioning_start() {
|
|
| 160 |
provisioning_get_files "${COMFYUI_DIR}/models/upscale_models" "${ESRGAN_MODELS[@]}"
|
| 161 |
provisioning_get_files "${COMFYUI_DIR}/user/default/workflows" "${WORKFLOWS[@]}"
|
| 162 |
provisioning_report_bad_files
|
| 163 |
-
|
| 164 |
}
|
| 165 |
|
| 166 |
function provisioning_check_tokens() {
|
| 167 |
if provisioning_has_valid_civitai_token; then
|
| 168 |
printf "CIVITAI_TOKEN : OK\n"
|
| 169 |
else
|
| 170 |
-
printf "\n⚠️ CIVITAI_TOKEN absent ou invalide : les modèles Civitai
|
| 171 |
-
fi
|
| 172 |
-
}
|
| 173 |
-
|
| 174 |
-
function provisioning_update_comfyui() {
|
| 175 |
-
# Krea 2 demande ComfyUI >= 0.26
|
| 176 |
-
if [[ ${AUTO_UPDATE,,} != "false" ]]; then
|
| 177 |
-
printf "Updating ComfyUI...\n"
|
| 178 |
-
( cd "${COMFYUI_DIR}" && git pull ) && pip install --no-cache-dir -r "${COMFYUI_DIR}/requirements.txt"
|
| 179 |
-
fi
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
function provisioning_fix_flash_attn() {
|
| 183 |
-
# Un flash_attn cassé fait planter xformers -> SeedVR2 ne se charge plus
|
| 184 |
-
if python -c "import flash_attn" >/dev/null 2>&1 || ls /venv/main/lib/python3*/site-packages/ 2>/dev/null | grep -qi "^flash_attn"; then
|
| 185 |
-
if ! python -c "import flash_attn.flash_attn_interface" >/dev/null 2>&1; then
|
| 186 |
-
printf "Removing broken flash_attn...\n"
|
| 187 |
-
pip uninstall -y flash-attn flash_attn >/dev/null 2>&1
|
| 188 |
-
rm -rf /venv/main/lib/python3*/site-packages/flash_attn*
|
| 189 |
-
fi
|
| 190 |
fi
|
| 191 |
}
|
| 192 |
|
| 193 |
function provisioning_report_bad_files() {
|
| 194 |
-
# Un téléchargement refusé produit un petit fichier HTML/JSON au lieu du modèle
|
| 195 |
printf "\nChecking for failed downloads...\n"
|
| 196 |
find "${COMFYUI_DIR}/models" -type f \( -name "*.safetensors" -o -name "*.pt" -o -name "*.pth" \) -size -100k 2>/dev/null | while read -r f; do
|
| 197 |
printf "⚠️ Fichier suspect (trop petit, probablement un échec) : %s\n" "$f"
|
| 198 |
done
|
| 199 |
}
|
| 200 |
|
| 201 |
-
function provisioning_get_apt_packages() {
|
| 202 |
-
if [[ -n $APT_PACKAGES ]]; then
|
| 203 |
-
sudo $APT_INSTALL ${APT_PACKAGES[@]}
|
| 204 |
-
fi
|
| 205 |
-
}
|
| 206 |
-
|
| 207 |
-
function provisioning_get_pip_packages() {
|
| 208 |
-
if [[ -n $PIP_PACKAGES ]]; then
|
| 209 |
-
pip install --no-cache-dir ${PIP_PACKAGES[@]}
|
| 210 |
-
fi
|
| 211 |
-
}
|
| 212 |
-
|
| 213 |
-
function pip_install_requirements() {
|
| 214 |
-
# Saute sam2 (git+facebookresearch/sam2) : sa compilation retélécharge PyTorch
|
| 215 |
-
# dans un environnement isolé et bloque le provisioning. Impact-Pack marche sans.
|
| 216 |
-
local filtered
|
| 217 |
-
filtered=$(mktemp)
|
| 218 |
-
grep -v -i "facebookresearch/sam2" "$1" > "$filtered"
|
| 219 |
-
pip install --no-cache-dir -r "$filtered"
|
| 220 |
-
rm -f "$filtered"
|
| 221 |
-
}
|
| 222 |
-
|
| 223 |
-
function provisioning_get_nodes() {
|
| 224 |
-
for repo in "${NODES[@]}"; do
|
| 225 |
-
dir="${repo##*/}"
|
| 226 |
-
path="${COMFYUI_DIR}/custom_nodes/${dir}"
|
| 227 |
-
requirements="${path}/requirements.txt"
|
| 228 |
-
if [[ -d $path ]]; then
|
| 229 |
-
if [[ ${AUTO_UPDATE,,} != "false" ]]; then
|
| 230 |
-
printf "Updating node: %s...\n" "${repo}"
|
| 231 |
-
( cd "$path" && git pull )
|
| 232 |
-
if [[ -e $requirements ]]; then
|
| 233 |
-
pip_install_requirements "$requirements"
|
| 234 |
-
fi
|
| 235 |
-
fi
|
| 236 |
-
else
|
| 237 |
-
printf "Downloading node: %s...\n" "${repo}"
|
| 238 |
-
git clone "${repo}" "${path}" --recursive
|
| 239 |
-
if [[ -e $requirements ]]; then
|
| 240 |
-
pip_install_requirements "${requirements}"
|
| 241 |
-
fi
|
| 242 |
-
fi
|
| 243 |
-
done
|
| 244 |
-
}
|
| 245 |
-
|
| 246 |
function provisioning_get_files() {
|
| 247 |
if [[ -z $2 ]]; then return 1; fi
|
| 248 |
-
|
| 249 |
dir="$1"
|
| 250 |
mkdir -p "$dir"
|
| 251 |
shift
|
| 252 |
arr=("$@")
|
| 253 |
printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir"
|
| 254 |
for entry in "${arr[@]}"; do
|
| 255 |
-
# Support "URL|filename" format for custom filenames
|
| 256 |
if [[ "$entry" == *"|"* ]]; then
|
| 257 |
url="${entry%%|*}"
|
| 258 |
filename="${entry##*|}"
|
|
@@ -266,23 +155,6 @@ function provisioning_get_files() {
|
|
| 266 |
done
|
| 267 |
}
|
| 268 |
|
| 269 |
-
function provisioning_print_header() {
|
| 270 |
-
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"
|
| 271 |
-
}
|
| 272 |
-
|
| 273 |
-
function provisioning_print_end() {
|
| 274 |
-
printf "\nProvisioning complete: Application will start now\n\n"
|
| 275 |
-
}
|
| 276 |
-
|
| 277 |
-
function provisioning_has_valid_hf_token() {
|
| 278 |
-
[[ -n "$HF_TOKEN" ]] || return 1
|
| 279 |
-
local code
|
| 280 |
-
code=$(curl -o /dev/null -s -w "%{http_code}" \
|
| 281 |
-
-H "Authorization: Bearer $HF_TOKEN" \
|
| 282 |
-
"https://huggingface.co/api/whoami-v2")
|
| 283 |
-
[[ "$code" -eq 200 ]]
|
| 284 |
-
}
|
| 285 |
-
|
| 286 |
function provisioning_has_valid_civitai_token() {
|
| 287 |
[[ -n "$CIVITAI_TOKEN" ]] || return 1
|
| 288 |
local code
|
|
@@ -291,7 +163,6 @@ function provisioning_has_valid_civitai_token() {
|
|
| 291 |
[[ "$code" -eq 200 ]]
|
| 292 |
}
|
| 293 |
|
| 294 |
-
# Téléchargement Civitai : token passé en paramètre d'URL, code HTTP affiché en cas d'échec
|
| 295 |
function download_civitai_bash() {
|
| 296 |
local url="$1" output_dir="$2" forced_filename="$3"
|
| 297 |
local model_id=""
|
|
@@ -320,7 +191,6 @@ function download_civitai_bash() {
|
|
| 320 |
printf "Download completed: %s\n" "$name"
|
| 321 |
}
|
| 322 |
|
| 323 |
-
# Download from $1 URL to $2 dir, with optional $3 forced filename
|
| 324 |
function provisioning_download() {
|
| 325 |
local url="$1"
|
| 326 |
local dir="$2"
|
|
@@ -338,14 +208,13 @@ function provisioning_download() {
|
|
| 338 |
printf "File already exists: %s\n" "$forced_filename"
|
| 339 |
return 0
|
| 340 |
fi
|
| 341 |
-
wget -q --show-progress "${hf_header[@]}" -e dotbytes=
|
| 342 |
else
|
| 343 |
-
wget -qnc --content-disposition --show-progress "${hf_header[@]}" -e dotbytes=
|
| 344 |
fi
|
| 345 |
fi
|
| 346 |
}
|
| 347 |
|
| 348 |
-
# Allow user to disable provisioning if they started with a script they didn't want
|
| 349 |
if [[ ! -f /.noprovisioning ]]; then
|
| 350 |
provisioning_start
|
| 351 |
fi
|
|
|
|
| 1 |
#!/bin/bash
|
| 2 |
# =============================================================================
|
| 3 |
+
# Krea 2 v1.5 — Provisioning ALLÉGÉ (pour l'image Docker perso)
|
| 4 |
+
# Les nodes et dépendances sont déjà dans l'image : ce script ne fait plus
|
| 5 |
+
# que télécharger les modèles.
|
| 6 |
#
|
| 7 |
+
# Variables d'environnement (template Vast) :
|
| 8 |
# CIVITAI_TOKEN (sinon la valeur en dur ci-dessous est utilisée)
|
| 9 |
# HF_TOKEN (optionnel)
|
|
|
|
| 10 |
# =============================================================================
|
| 11 |
|
| 12 |
source /venv/main/bin/activate
|
| 13 |
COMFYUI_DIR=${WORKSPACE}/ComfyUI
|
| 14 |
|
| 15 |
+
CIVITAI_TOKEN="${CIVITAI_TOKEN:-ee2791108127cd78eb0217b6207b4fe2}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Workflows : uploade d'abord Krea2_v1.5.json dans ton repo HF nathanglm/sofia
|
| 18 |
WORKFLOWS=(
|
|
|
|
| 58 |
"https://huggingface.co/nathanglm/sofia/resolve/main/model01.safetensors|model01.safetensors"
|
| 59 |
|
| 60 |
# --- SDXL (détailleurs SDXL du workflow Krea2 v1.5) ---
|
|
|
|
| 61 |
#"https://civitai.com/api/download/models/368603|SDXL-Detailed-Nipples-v1.safetensors"
|
| 62 |
#"https://civitai.com/api/download/models/712004|SDXL-Real-Pussy-Lotte.safetensors"
|
| 63 |
#"https://civitai.com/api/download/models/216946|SDXL-Penis-XL-v1.safetensors"
|
|
|
|
| 68 |
"https://civitai.com/api/download/models/1621447|sdxl-iniversemix.safetensors"
|
| 69 |
)
|
| 70 |
|
|
|
|
| 71 |
UNET_MODELS=(
|
| 72 |
)
|
| 73 |
|
|
|
|
| 92 |
"https://huggingface.co/Bingsu/adetailer/resolve/main/person_yolov8m-seg.pt"
|
| 93 |
)
|
| 94 |
|
|
|
|
|
|
|
| 95 |
ESRGAN_MODELS=(
|
| 96 |
)
|
| 97 |
|
|
|
|
| 101 |
### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
|
| 102 |
|
| 103 |
function provisioning_start() {
|
| 104 |
+
printf "\n=== Provisioning Krea 2 (modèles uniquement) ===\n\n"
|
| 105 |
provisioning_check_tokens
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
provisioning_get_files "${COMFYUI_DIR}/models/diffusion_models" "${DIFFUSION_MODELS[@]}"
|
| 107 |
provisioning_get_files "${COMFYUI_DIR}/models/text_encoders" "${TEXT_ENCODERS[@]}"
|
| 108 |
provisioning_get_files "${COMFYUI_DIR}/models/vae" "${VAE_MODELS[@]}"
|
|
|
|
| 116 |
provisioning_get_files "${COMFYUI_DIR}/models/upscale_models" "${ESRGAN_MODELS[@]}"
|
| 117 |
provisioning_get_files "${COMFYUI_DIR}/user/default/workflows" "${WORKFLOWS[@]}"
|
| 118 |
provisioning_report_bad_files
|
| 119 |
+
printf "\nProvisioning complete: Application will start now\n\n"
|
| 120 |
}
|
| 121 |
|
| 122 |
function provisioning_check_tokens() {
|
| 123 |
if provisioning_has_valid_civitai_token; then
|
| 124 |
printf "CIVITAI_TOKEN : OK\n"
|
| 125 |
else
|
| 126 |
+
printf "\n⚠️ CIVITAI_TOKEN absent ou invalide : les modèles Civitai vont échouer.\n\n"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
fi
|
| 128 |
}
|
| 129 |
|
| 130 |
function provisioning_report_bad_files() {
|
|
|
|
| 131 |
printf "\nChecking for failed downloads...\n"
|
| 132 |
find "${COMFYUI_DIR}/models" -type f \( -name "*.safetensors" -o -name "*.pt" -o -name "*.pth" \) -size -100k 2>/dev/null | while read -r f; do
|
| 133 |
printf "⚠️ Fichier suspect (trop petit, probablement un échec) : %s\n" "$f"
|
| 134 |
done
|
| 135 |
}
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
function provisioning_get_files() {
|
| 138 |
if [[ -z $2 ]]; then return 1; fi
|
|
|
|
| 139 |
dir="$1"
|
| 140 |
mkdir -p "$dir"
|
| 141 |
shift
|
| 142 |
arr=("$@")
|
| 143 |
printf "Downloading %s model(s) to %s...\n" "${#arr[@]}" "$dir"
|
| 144 |
for entry in "${arr[@]}"; do
|
|
|
|
| 145 |
if [[ "$entry" == *"|"* ]]; then
|
| 146 |
url="${entry%%|*}"
|
| 147 |
filename="${entry##*|}"
|
|
|
|
| 155 |
done
|
| 156 |
}
|
| 157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
function provisioning_has_valid_civitai_token() {
|
| 159 |
[[ -n "$CIVITAI_TOKEN" ]] || return 1
|
| 160 |
local code
|
|
|
|
| 163 |
[[ "$code" -eq 200 ]]
|
| 164 |
}
|
| 165 |
|
|
|
|
| 166 |
function download_civitai_bash() {
|
| 167 |
local url="$1" output_dir="$2" forced_filename="$3"
|
| 168 |
local model_id=""
|
|
|
|
| 191 |
printf "Download completed: %s\n" "$name"
|
| 192 |
}
|
| 193 |
|
|
|
|
| 194 |
function provisioning_download() {
|
| 195 |
local url="$1"
|
| 196 |
local dir="$2"
|
|
|
|
| 208 |
printf "File already exists: %s\n" "$forced_filename"
|
| 209 |
return 0
|
| 210 |
fi
|
| 211 |
+
wget -q --show-progress "${hf_header[@]}" -e dotbytes=4M -O "${dir}/${forced_filename}" "$url" || rm -f "${dir}/${forced_filename}"
|
| 212 |
else
|
| 213 |
+
wget -qnc --content-disposition --show-progress "${hf_header[@]}" -e dotbytes=4M -P "$dir" "$url"
|
| 214 |
fi
|
| 215 |
fi
|
| 216 |
}
|
| 217 |
|
|
|
|
| 218 |
if [[ ! -f /.noprovisioning ]]; then
|
| 219 |
provisioning_start
|
| 220 |
fi
|