39 lines
1.3 KiB
Bash
Executable File
39 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# watcher.sh - Watches for new models, downloads their files, and tracks large files with Git LFS.
|
|
#
|
|
# This script continuously scans the 'models' directory for 'model.yaml' files.
|
|
# For each model, it runs the 'download.sh' script to fetch model files from
|
|
# Hugging Face. After downloading, it identifies files larger than 1MB and
|
|
# ensures they are tracked by Git LFS.
|
|
#
|
|
# Usage: ./tools/watcher.sh
|
|
# Run from the root of the repository.
|
|
|
|
# This script should be run from the root of the repository.
|
|
if [ ! -d ".git" ]; then
|
|
echo "Error: This script must be run from the root of the repository." >&2
|
|
exit 1
|
|
fi
|
|
|
|
while true; do
|
|
echo "🔍 Starting model discovery cycle..."
|
|
|
|
# Find all model.yaml files in the models directory
|
|
find models -name model.yaml | while read -r MODEL_YAML; do
|
|
MODEL_DIR=$(dirname "$MODEL_YAML")
|
|
|
|
echo "--------------------------------------------------"
|
|
echo "Processing model in $MODEL_DIR"
|
|
|
|
# The download script will now handle LFS tracking and cleanup for each variant.
|
|
python3 ./tools/download.py "$MODEL_YAML"
|
|
done
|
|
|
|
echo "--------------------------------------------------"
|
|
echo "✅ Watcher finished a cycle. Sleeping for 60 seconds before next scan."
|
|
echo "Press [CTRL+C] to stop."
|
|
sleep 60
|
|
done
|