Spaces:
Runtime error
Runtime error
File size: 3,450 Bytes
ca28016 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #!/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 |