HNTAI / deploy_fix.sh
sachinchandrankallar's picture
gguf fix
8704dff
#!/bin/bash
# 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."