Spaces:
Paused
Paused
Update start.sh
Browse files
start.sh
CHANGED
|
@@ -51,28 +51,54 @@ export HF_HUB_ENABLE_HF_TRANSFER=1
|
|
| 51 |
export HF_HUB_DOWNLOAD_TIMEOUT=60
|
| 52 |
|
| 53 |
MODEL_REPO="ByteDance-Seed/VINCIE-3B"
|
| 54 |
-
CACHE_MODEL_DIR="$HF_HUB_CACHE/models--ByteDance-Seed--VINCIE-3B"
|
| 55 |
CKPT_DIR="/app/ckpt/VINCIE-3B"
|
| 56 |
mkdir -p "$CKPT_DIR"
|
| 57 |
|
| 58 |
-
# ----------------------
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
python3 - <<'PY'
|
| 61 |
from huggingface_hub import snapshot_download
|
| 62 |
import os
|
| 63 |
-
|
| 64 |
-
os.
|
|
|
|
|
|
|
| 65 |
try:
|
| 66 |
-
|
| 67 |
-
snapshot_download(
|
| 68 |
repo_id='ByteDance-Seed/VINCIE-3B',
|
| 69 |
-
|
| 70 |
-
resume_download=True,
|
| 71 |
-
|
|
|
|
| 72 |
)
|
| 73 |
-
print('✅ Modelo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
except Exception as e:
|
| 75 |
print(f'⚠️ Download falhou: {e}')
|
|
|
|
|
|
|
| 76 |
PY
|
| 77 |
|
| 78 |
|
|
@@ -91,10 +117,6 @@ else
|
|
| 91 |
fi
|
| 92 |
|
| 93 |
|
| 94 |
-
# Triton 3.x (sem triton.ops)
|
| 95 |
-
pip uninstall -y triton || true && \
|
| 96 |
-
pip install -v --no-build-isolation triton==3.2.0
|
| 97 |
-
|
| 98 |
|
| 99 |
# ---------------------- Diagnóstico ----------------------
|
| 100 |
/app/info.sh || true
|
|
|
|
| 51 |
export HF_HUB_DOWNLOAD_TIMEOUT=60
|
| 52 |
|
| 53 |
MODEL_REPO="ByteDance-Seed/VINCIE-3B"
|
|
|
|
| 54 |
CKPT_DIR="/app/ckpt/VINCIE-3B"
|
| 55 |
mkdir -p "$CKPT_DIR"
|
| 56 |
|
| 57 |
+
# ---------------------- Cache Estruturado HF (persistente) ----------------------
|
| 58 |
|
| 59 |
+
# Define cache no volume persistente /data (1TB)
|
| 60 |
+
if [ -d /data ]; then
|
| 61 |
+
export HF_HOME="${HF_HOME:-/data/.cache/huggingface}"
|
| 62 |
+
else
|
| 63 |
+
export HF_HOME="${HF_HOME:-/app/.cache/huggingface}"
|
| 64 |
+
fi
|
| 65 |
+
|
| 66 |
+
export HF_HUB_CACHE="${HF_HUB_CACHE:-$HF_HOME/hub}"
|
| 67 |
+
mkdir -p "$HF_HUB_CACHE"
|
| 68 |
+
|
| 69 |
+
echo "📦 Cache HF: $HF_HUB_CACHE"
|
| 70 |
+
|
| 71 |
+
# Download usando cache estruturado (não duplica arquivos)
|
| 72 |
python3 - <<'PY'
|
| 73 |
from huggingface_hub import snapshot_download
|
| 74 |
import os
|
| 75 |
+
|
| 76 |
+
cache_dir = os.environ.get('HF_HUB_CACHE')
|
| 77 |
+
print(f'📥 Baixando VINCIE-3B para cache: {cache_dir}')
|
| 78 |
+
|
| 79 |
try:
|
| 80 |
+
model_path = snapshot_download(
|
|
|
|
| 81 |
repo_id='ByteDance-Seed/VINCIE-3B',
|
| 82 |
+
cache_dir=cache_dir, # Usa cache estruturado
|
| 83 |
+
resume_download=True, # Retoma downloads interrompidos
|
| 84 |
+
max_workers=8, # Acelera com paralelismo
|
| 85 |
+
# Não usa local_dir - mantém tudo no cache HF
|
| 86 |
)
|
| 87 |
+
print(f'✅ Modelo em cache: {model_path}')
|
| 88 |
+
|
| 89 |
+
# Cria symlink para compatibilidade com código legacy
|
| 90 |
+
ckpt_link = '/app/ckpt/VINCIE-3B'
|
| 91 |
+
os.makedirs('/app/ckpt', exist_ok=True)
|
| 92 |
+
if os.path.islink(ckpt_link):
|
| 93 |
+
os.unlink(ckpt_link)
|
| 94 |
+
if not os.path.exists(ckpt_link):
|
| 95 |
+
os.symlink(model_path, ckpt_link)
|
| 96 |
+
print(f'🔗 Symlink: {ckpt_link} -> {model_path}')
|
| 97 |
+
|
| 98 |
except Exception as e:
|
| 99 |
print(f'⚠️ Download falhou: {e}')
|
| 100 |
+
import traceback
|
| 101 |
+
traceback.print_exc()
|
| 102 |
PY
|
| 103 |
|
| 104 |
|
|
|
|
| 117 |
fi
|
| 118 |
|
| 119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
|
| 121 |
# ---------------------- Diagnóstico ----------------------
|
| 122 |
/app/info.sh || true
|