Axon / entrypoint.sh
AIencoder's picture
Update entrypoint.sh
e0e1f07 verified
raw
history blame
1.1 kB
#!/bin/bash
set -e
# 1. Define the directory
MODEL_DIR="/data/models"
# 2. Print status
echo "--- ENTRYPOINT STARTED ---"
echo "Checking model directory: $MODEL_DIR"
# 3. Create directory if it doesn't exist
mkdir -p $MODEL_DIR
# 4. Check if directory is empty
if [ -z "$(ls -A $MODEL_DIR)" ]; then
echo "⚠️ Folder is empty! Starting download..."
# Run the download script (using the Python snippet usually found here)
# We use python to leverage the huggingface_hub library for faster/resumable downloads
python3 -c "
from huggingface_hub import snapshot_download
import os
print('⬇️ Downloading models to /data/models...')
try:
snapshot_download(
repo_id='AIencoder/Axon-Models',
local_dir='/data/models',
local_dir_use_symlinks=False,
repo_type='model'
)
print('✅ Download complete!')
except Exception as e:
print(f'❌ Download failed: {e}')
"
else
echo "✅ Models found in $MODEL_DIR. Skipping download."
ls -lh $MODEL_DIR
fi
# 5. Hand over control to the main app
echo "--- STARTING APP ---"
exec "$@"