Spaces:
Running
Running
# Deployment script for GGUF model fixes | |
# This script helps deploy the fixes to resolve 500 errors in Hugging Face Spaces | |
echo "π Deploying GGUF Model Fixes to Hugging Face Spaces" | |
echo "==================================================" | |
# Check if we're in the right directory | |
if [ ! -f "requirements.txt" ] || [ ! -f "ai_med_extract/utils/model_loader_gguf.py" ]; then | |
echo "β Error: Please run this script from the HNTAI directory" | |
exit 1 | |
fi | |
# Check git status | |
echo "π Checking git status..." | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "π Changes detected. Committing fixes..." | |
git add . | |
git commit -m "Fix GGUF model 500 errors with enhanced error handling and fallbacks | |
- Added comprehensive error handling and logging | |
- Implemented timeout management for model loading and generation | |
- Added fallback pipeline when GGUF models fail | |
- Optimized memory usage for Hugging Face Spaces | |
- Reduced context window and batch sizes | |
- Added threading-based timeout mechanisms" | |
else | |
echo "β No changes to commit" | |
fi | |
# Push to remote | |
echo "π Pushing to remote repository..." | |
if git push; then | |
echo "β Successfully pushed fixes to remote repository" | |
echo "" | |
echo "π― Next Steps:" | |
echo "1. Your Hugging Face Space will automatically rebuild" | |
echo "2. Monitor the build logs for any errors" | |
echo "3. Test the API with your GGUF model parameters" | |
echo "4. Check the logs for 'GGUF' prefixed messages" | |
echo "" | |
echo "π To test the fix, call your API with:" | |
echo ' "patient_summarizer_model_name": "microsoft/Phi-3-mini-4k-instruct-gguf/Phi-3-mini-4k-instruct-q4.gguf"' | |
echo ' "patient_summarizer_model_type": "gguf"' | |
echo "" | |
echo "π Expected behavior:" | |
echo " - Before: 500 errors after 5 minutes" | |
echo " - After: Success or graceful fallback with detailed logging" | |
echo "" | |
echo "π For troubleshooting, see: GGUF_TROUBLESHOOTING.md" | |
else | |
echo "β Failed to push to remote repository" | |
echo "Please check your git remote configuration" | |
exit 1 | |
fi | |
echo "" | |
echo "π Deployment complete! Your fixes should resolve the 500 errors." | |