golem-flask-backend / TURBOCHARGE_NOW.sh
mememechez's picture
Deploy final cleaned source code
ca28016
#!/bin/bash
# โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
# โ•‘ ๐Ÿš€ ONE-CLICK TURBOCHARGE FOR QWEN2GOLEM ๐Ÿš€ โ•‘
# โ•‘ Press this button to make EVERYTHING LIGHTNING FAST! โ•‘
# โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
echo ""
echo " โšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšก"
echo " ๐Ÿ”ฅ INITIATING ULTIMATE TURBOCHARGE SEQUENCE ๐Ÿ”ฅ"
echo " โšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšกโšก"
echo ""
echo " Target System: RTX 3050 6GB + i5 CPU + 16GB RAM"
echo " Mission: ACHIEVE LIGHTNING SPEED WITHOUT COMPROMISE!"
echo ""
# Countdown for dramatic effect
echo " Launching in..."
for i in 3 2 1; do
echo " $i..."
sleep 1
done
echo " ๐Ÿš€ BLAST OFF!"
echo ""
# Check if we need to install first
if [ ! -f "golem_optimizer.py" ] || [ ! -f "voice_optimizer.py" ]; then
echo "โš ๏ธ Optimization files not found. Running installer first..."
if [ -f "install_optimizations.sh" ]; then
chmod +x install_optimizations.sh
./install_optimizations.sh
else
echo "โŒ Installation script not found! Please ensure all files are present."
exit 1
fi
fi
# Start Redis if not running
echo "๐Ÿ—„๏ธ Checking Redis cache..."
if ! pgrep -x "redis-server" > /dev/null; then
echo " Starting Redis server (user mode)..."
redis-server --daemonize yes || true
fi
# Clear GPU cache
echo "๐ŸŽฎ Preparing GPU..."
python -c "
import torch
if torch.cuda.is_available():
torch.cuda.empty_cache()
torch.cuda.synchronize()
print(' โœ… GPU cache cleared')
else:
print(' โš ๏ธ GPU not available')
"
# Refresh Gemini keys
echo "๐Ÿ”‘ Refreshing API keys..."
if [ -f "refresh_gemini_keys.sh" ]; then
./refresh_gemini_keys.sh > /dev/null 2>&1 &
echo " โœ… Key refresh running in background"
fi
# Run the main optimizer
echo ""
echo "โšก APPLYING OPTIMIZATIONS..."
python golem_optimizer.py
# Start the optimized server
echo ""
echo "๐Ÿš€ STARTING TURBOCHARGED SERVER..."
echo ""
# Set environment variables for maximum performance
export CUDA_VISIBLE_DEVICES=0
export PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
export CUDA_LAUNCH_BLOCKING=0
export TORCH_CUDNN_V8_API_ENABLED=1
export TF32_ENABLE=1
export CUBLAS_WORKSPACE_CONFIG=:4096:8
# Check if gunicorn is available
if command -v gunicorn &> /dev/null; then
echo "โœ… Starting with Gunicorn (optimal performance)..."
gunicorn home.chezy.golem_flask_server:app \
--workers 4 \
--worker-class gevent \
--worker-connections 1000 \
--bind 0.0.0.0:5000 \
--timeout 30 \
--keep-alive 5 \
--max-requests 10000 \
--max-requests-jitter 1000 \
--log-level info
else
echo "โš ๏ธ Gunicorn not found, starting with Flask development server..."
echo " (Install gunicorn and gevent for better performance)"
# Free port 5000 if busy
if lsof -i :5000 -t >/dev/null 2>&1; then
echo " Port 5000 busy; stopping old process..."
kill -9 $(lsof -i :5000 -t) || true
sleep 1
fi
cd home/chezy/
python golem_flask_server.py
fi