api-mg / setup.sh
MGZON's picture
Optimize startup with reduced threads and timing logs
1cb386c verified
#!/usr/bin/env bash
set -e
# ุฅู†ุดุงุก ู…ุฌู„ุฏุงุช ู„ุชุฎุฒูŠู† ุงู„ู†ู…ุงุฐุฌ ูˆุงู„ู€ cache
mkdir -p models /app/.cache/huggingface/hub
chown -R appuser:appuser models /app/.cache/huggingface
chmod -R 755 /app/.cache/huggingface
# ุชุญู…ูŠู„ ู…ู„ู Mistral .gguf ุฅุฐุง ู„ู… ูŠูƒู† ู…ูˆุฌูˆุฏู‹ุง ู…ุณุจู‚ู‹ุง
python - <<PY
from huggingface_hub import hf_hub_download
import os
repo_id = "TheBloke/Mistral-7B-Instruct-v0.1-GGUF"
filename = "mistral-7b-instruct-v0.1.Q2_K.gguf"
local_dir = "models"
if not os.path.exists(os.path.join(local_dir, filename)):
hf_hub_download(
repo_id=repo_id,
filename=filename,
local_dir=local_dir,
local_dir_use_symlinks=False,
force_download=False
)
print("โœ… ุชู… ุชุญู…ูŠู„ Mistral .gguf")
else:
print("โœ… ู…ู„ู Mistral .gguf ู…ูˆุฌูˆุฏ ู…ุณุจู‚ู‹ุง")
PY
# ุชุญู…ูŠู„ ู†ู…ูˆุฐุฌ MGZON-FLAN-T5 ุฅุฐุง ู„ู… ูŠูƒู† ู…ูˆุฌูˆุฏู‹ุง ู…ุณุจู‚ู‹ุง
python - <<PY
from huggingface_hub import snapshot_download
import os
repo_id = "MGZON/mgzon-flan-t5-base"
local_dir = "/app/.cache/huggingface/hub/models--MGZON--mgzon-flan-t5-base/snapshots"
if not os.path.exists(local_dir):
snapshot_download(
repo_id=repo_id,
local_dir=local_dir,
local_dir_use_symlinks=False,
force_download=False
)
print("โœ… ุชู… ุชุญู…ูŠู„ MGZON-FLAN-T5")
else:
print("โœ… ู…ู„ูุงุช MGZON-FLAN-T5 ู…ูˆุฌูˆุฏุฉ ู…ุณุจู‚ู‹ุง")
PY