linkscout-backend / MEMORY_ERROR_FIX.md
zpsajst's picture
Initial commit with environment variables for API keys
2398be6

🚨 MEMORY ERROR FIX - Windows Paging File Too Small

Error You're Seeing

OSError: [WinError 1455] The paging file is too small for this operation to complete

This happens when Windows virtual memory (paging file) is too small to load PyTorch and all AI models.

πŸ”§ QUICK FIX: Increase Windows Virtual Memory

Step 1: Open System Properties

  1. Press Win + Pause/Break OR
  2. Right-click "This PC" β†’ Properties
  3. Click "Advanced system settings" (left sidebar)
  4. Click "Settings" under Performance section

Step 2: Increase Virtual Memory

  1. Go to "Advanced" tab
  2. Click "Change" under Virtual Memory
  3. Uncheck "Automatically manage paging file size"
  4. Select your system drive (usually C:)
  5. Choose "Custom size"
  6. Set both values:
    • Initial size: 16000 MB (16 GB)
    • Maximum size: 32000 MB (32 GB)
  7. Click "Set"
  8. Click "OK" on all windows
  9. RESTART YOUR COMPUTER

Step 3: After Restart

cd D:\mis_2\LinkScout
python combined_server.py

Server should now start successfully!


βœ… What I Fixed in Code

I implemented lazy loading so models only load when actually needed:

  • βœ… NER model: Loads on first entity extraction
  • βœ… Hate Speech: Loads on first hate speech detection
  • βœ… Clickbait: Loads on first clickbait check
  • βœ… Bias: Loads on first bias analysis

Before: All 8 models loaded at startup (crashed)
After: Only RoBERTa + Emotion load at startup, others load on-demand


🎯 Expected Startup After Fix

πŸ“± Using device: cpu
πŸš€ Loading AI models...
Loading RoBERTa fake news detector...
βœ… RoBERTa loaded
Loading emotion classifier...
βœ… Emotion model loaded
⏳ NER model: lazy loading (loads on first use)
⏳ Hate Speech detector: lazy loading (loads on first use)
⏳ Clickbait detector: lazy loading (loads on first use)
⏳ Bias detector: lazy loading (loads on first use)
βœ… Core models loaded (RoBERTa, Emotion)
πŸ”§ Initializing Reinforcement Learning...
πŸ’Ύ [RL] No saved model found, starting fresh
🧠 RL Agent: READY (Episodes: 0)
βœ… Server running on http://localhost:5000

πŸ†˜ If You Can't Increase Virtual Memory

Alternative 1: Use Lighter Server (MIS Directory)

The MIS server has better memory management:

cd D:\mis_2\mis
python agentic_server.py

Alternative 2: Disable Some Models

Edit combined_server.py and comment out models you don't need.

Alternative 3: Add More RAM

If your PC has <8GB RAM, consider upgrading to 16GB+.


πŸ“Š Current System Requirements

Minimum:

  • RAM: 8GB
  • Virtual Memory: 16GB
  • Disk Space: 10GB (for models cache)

Recommended:

  • RAM: 16GB+
  • Virtual Memory: 32GB
  • Disk Space: 20GB

βœ… After Server Starts

  1. Reload LinkScout extension (chrome://extensions/)
  2. Visit any news article
  3. Click LinkScout icon
  4. Click "Scan Page"
  5. RL system works with feedback buttons!

Last Updated: October 21, 2025
Issue: Windows paging file too small for PyTorch + 8 AI models
Solution: Increase virtual memory to 16-32GB + Lazy loading implemented