Update image_Studio.sh
Browse files- image_Studio.sh +21 -17
image_Studio.sh
CHANGED
|
@@ -110,6 +110,9 @@ reset_state() {
|
|
| 110 |
# Lista de downloads (ATUALIZADA - sem ControlNet)
|
| 111 |
# -----------------------------
|
| 112 |
readonly DOWNLOAD_FILES=(
|
|
|
|
|
|
|
|
|
|
| 113 |
# Checkpoint mantido
|
| 114 |
"https://civitai.com/api/download/models/2122278?type=Model&format=SafeTensor&size=pruned&fp=fp16|checkpoints|raehoshiIllustXL_v60.safetensors"
|
| 115 |
|
|
@@ -121,9 +124,6 @@ readonly DOWNLOAD_FILES=(
|
|
| 121 |
"https://civitai.com/api/download/models/1114313?type=Model&format=SafeTensor|loras|"
|
| 122 |
"https://civitai.com/api/download/models/1780244?type=Model&format=SafeTensor|loras|"
|
| 123 |
|
| 124 |
-
# LoRA from Mega (nome automático pelo megadl)
|
| 125 |
-
"mega://https://mega.nz/file/gIRTFQSQ#no6Ay3JLE9LVRi7ib9O-Jc0CW7XmG046kCgpCzDg1tY|loras|"
|
| 126 |
-
|
| 127 |
# Upscale models - Coleção completa
|
| 128 |
"https://huggingface.co/Kim2091/AnimeSharp/resolve/main/4x-AnimeSharp.pth|upscale_models|4x-AnimeSharp.pth"
|
| 129 |
"https://huggingface.co/Kim2091/AnimeSharpV3/resolve/main/2x-AnimeSharpV3.pth|upscale_models|2x-AnimeSharpV3.pth"
|
|
@@ -219,24 +219,16 @@ download_mega() {
|
|
| 219 |
# Remover prefixo mega:// se houver
|
| 220 |
url="${url#mega://}"
|
| 221 |
|
| 222 |
-
log_info "
|
| 223 |
|
| 224 |
-
# Usar megadl
|
| 225 |
cd "$target_dir"
|
| 226 |
-
if megadl "$url"; then
|
| 227 |
-
# Se especificou nome, renomear
|
| 228 |
-
if [ -n "$filename" ]; then
|
| 229 |
-
# Encontrar o arquivo baixado (o mais recente)
|
| 230 |
-
local downloaded=$(ls -t | head -1)
|
| 231 |
-
if [ -n "$downloaded" ] && [ "$downloaded" != "$filename" ]; then
|
| 232 |
-
mv "$downloaded" "$filename"
|
| 233 |
-
fi
|
| 234 |
-
fi
|
| 235 |
log_success "Download do Mega concluído"
|
| 236 |
cd - >/dev/null
|
| 237 |
return 0
|
| 238 |
else
|
| 239 |
-
log_error "
|
| 240 |
cd - >/dev/null
|
| 241 |
return 1
|
| 242 |
fi
|
|
@@ -364,16 +356,21 @@ process_downloads() {
|
|
| 364 |
local failed_count=0
|
| 365 |
|
| 366 |
log_info "Total de downloads: $total"
|
|
|
|
| 367 |
|
| 368 |
for entry in "${DOWNLOAD_FILES[@]}"; do
|
| 369 |
((current++))
|
| 370 |
|
|
|
|
|
|
|
| 371 |
# Verificar se já foi baixado
|
| 372 |
if is_download_complete "$entry"; then
|
| 373 |
log_success "[$current/$total] Já baixado, pulando..."
|
| 374 |
continue
|
| 375 |
fi
|
| 376 |
|
|
|
|
|
|
|
| 377 |
IFS='|' read -r url type filename <<< "$entry"
|
| 378 |
|
| 379 |
# Limpar espaços
|
|
@@ -381,6 +378,9 @@ process_downloads() {
|
|
| 381 |
type=$(echo "$type" | xargs)
|
| 382 |
filename=$(echo "$filename" | xargs)
|
| 383 |
|
|
|
|
|
|
|
|
|
|
| 384 |
# Determinar diretório de destino
|
| 385 |
local target_dir="$MODELS_DIR"
|
| 386 |
case "$type" in
|
|
@@ -594,8 +594,9 @@ main() {
|
|
| 594 |
local gpu_info=$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null || echo "")
|
| 595 |
|
| 596 |
if [[ "$gpu_info" == *"5090"* ]] || [[ "$gpu_info" == *"5080"* ]]; then
|
| 597 |
-
log_warn "RTX ${gpu_info} detectada -
|
| 598 |
-
#
|
|
|
|
| 599 |
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
|
| 600 |
log_success "PyTorch nightly instalado"
|
| 601 |
else
|
|
@@ -610,7 +611,10 @@ main() {
|
|
| 610 |
log_info "[5/6] Baixando modelos..."
|
| 611 |
mkdir -p "$MODELS_DIR"/{diffusion_models,loras,vae,vae_approx,text_encoders,clip_vision,upscale_models,checkpoints,ultralytics/bbox}
|
| 612 |
|
|
|
|
| 613 |
process_downloads
|
|
|
|
|
|
|
| 614 |
log_success "Downloads processados"
|
| 615 |
save_state "5"
|
| 616 |
fi
|
|
|
|
| 110 |
# Lista de downloads (ATUALIZADA - sem ControlNet)
|
| 111 |
# -----------------------------
|
| 112 |
readonly DOWNLOAD_FILES=(
|
| 113 |
+
# LoRA from Mega (PRIMEIRO para falhar rápido se houver problema)
|
| 114 |
+
"mega://https://mega.nz/file/gIRTFQSQ#no6Ay3JLE9LVRi7ib9O-Jc0CW7XmG046kCgpCzDg1tY|loras|"
|
| 115 |
+
|
| 116 |
# Checkpoint mantido
|
| 117 |
"https://civitai.com/api/download/models/2122278?type=Model&format=SafeTensor&size=pruned&fp=fp16|checkpoints|raehoshiIllustXL_v60.safetensors"
|
| 118 |
|
|
|
|
| 124 |
"https://civitai.com/api/download/models/1114313?type=Model&format=SafeTensor|loras|"
|
| 125 |
"https://civitai.com/api/download/models/1780244?type=Model&format=SafeTensor|loras|"
|
| 126 |
|
|
|
|
|
|
|
|
|
|
| 127 |
# Upscale models - Coleção completa
|
| 128 |
"https://huggingface.co/Kim2091/AnimeSharp/resolve/main/4x-AnimeSharp.pth|upscale_models|4x-AnimeSharp.pth"
|
| 129 |
"https://huggingface.co/Kim2091/AnimeSharpV3/resolve/main/2x-AnimeSharpV3.pth|upscale_models|2x-AnimeSharpV3.pth"
|
|
|
|
| 219 |
# Remover prefixo mega:// se houver
|
| 220 |
url="${url#mega://}"
|
| 221 |
|
| 222 |
+
log_info "Executando: megadl '$url'"
|
| 223 |
|
| 224 |
+
# Usar megadl com timeout
|
| 225 |
cd "$target_dir"
|
| 226 |
+
if timeout 300 megadl "$url"; then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
log_success "Download do Mega concluído"
|
| 228 |
cd - >/dev/null
|
| 229 |
return 0
|
| 230 |
else
|
| 231 |
+
log_error "Mega falhou ou timeout (5 min)"
|
| 232 |
cd - >/dev/null
|
| 233 |
return 1
|
| 234 |
fi
|
|
|
|
| 356 |
local failed_count=0
|
| 357 |
|
| 358 |
log_info "Total de downloads: $total"
|
| 359 |
+
log_info "Iniciando loop de downloads..."
|
| 360 |
|
| 361 |
for entry in "${DOWNLOAD_FILES[@]}"; do
|
| 362 |
((current++))
|
| 363 |
|
| 364 |
+
log_info "[$current/$total] Processando entrada..."
|
| 365 |
+
|
| 366 |
# Verificar se já foi baixado
|
| 367 |
if is_download_complete "$entry"; then
|
| 368 |
log_success "[$current/$total] Já baixado, pulando..."
|
| 369 |
continue
|
| 370 |
fi
|
| 371 |
|
| 372 |
+
log_info "[$current/$total] Preparando download..."
|
| 373 |
+
|
| 374 |
IFS='|' read -r url type filename <<< "$entry"
|
| 375 |
|
| 376 |
# Limpar espaços
|
|
|
|
| 378 |
type=$(echo "$type" | xargs)
|
| 379 |
filename=$(echo "$filename" | xargs)
|
| 380 |
|
| 381 |
+
log_info "[$current/$total] URL: ${url:0:60}..."
|
| 382 |
+
log_info "[$current/$total] Tipo: $type"
|
| 383 |
+
|
| 384 |
# Determinar diretório de destino
|
| 385 |
local target_dir="$MODELS_DIR"
|
| 386 |
case "$type" in
|
|
|
|
| 594 |
local gpu_info=$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null || echo "")
|
| 595 |
|
| 596 |
if [[ "$gpu_info" == *"5090"* ]] || [[ "$gpu_info" == *"5080"* ]]; then
|
| 597 |
+
log_warn "RTX ${gpu_info} detectada - instalando PyTorch nightly"
|
| 598 |
+
# FORÇAR reinstalação do PyTorch nightly
|
| 599 |
+
pip uninstall -y torch torchvision torchaudio 2>/dev/null || true
|
| 600 |
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
|
| 601 |
log_success "PyTorch nightly instalado"
|
| 602 |
else
|
|
|
|
| 611 |
log_info "[5/6] Baixando modelos..."
|
| 612 |
mkdir -p "$MODELS_DIR"/{diffusion_models,loras,vae,vae_approx,text_encoders,clip_vision,upscale_models,checkpoints,ultralytics/bbox}
|
| 613 |
|
| 614 |
+
log_info "Chamando process_downloads..."
|
| 615 |
process_downloads
|
| 616 |
+
log_info "process_downloads terminou"
|
| 617 |
+
|
| 618 |
log_success "Downloads processados"
|
| 619 |
save_state "5"
|
| 620 |
fi
|