Medical_Document_Retrieval / FIX_MEMORY_ISSUE.md
taraky's picture
Upload folder using huggingface_hub
b7f3196 verified

A newer version of the Gradio SDK is available: 6.1.0

Upgrade

Fixing Memory Issue - Windows Virtual Memory

Problem

OSError: The paging file is too small for this operation to complete. (os error 1455)

Your system needs more virtual memory to load the large AI models (1.21GB+).

Solution: Increase Windows Virtual Memory

Step-by-Step Instructions:

  1. Open System Properties

    • Press Windows Key + Pause/Break OR
    • Right-click "This PC" → Properties → Advanced system settings
  2. Access Virtual Memory Settings

    • Click "Advanced" tab
    • Under "Performance", click "Settings..."
    • Click "Advanced" tab again
    • Under "Virtual memory", click "Change..."
  3. Configure Virtual Memory

    • Uncheck "Automatically manage paging file size for all drives"
    • Select your C: drive (or main drive)
    • Select "Custom size"
    • Set values:
      • Initial size (MB): 8192 (8 GB)
      • Maximum size (MB): 16384 (16 GB)
    • Click "Set"
    • Click "OK" on all dialogs
  4. Restart Your Computer

    • This is required for changes to take effect
  5. Try Running the App Again

    python app.py
    

Alternative: Quick Fix (Temporary)

If you can't change virtual memory settings, try these:

Option A: Close Other Programs

  • Close all browsers, apps, and programs
  • This frees up RAM
  • Then try running the app again

Option B: Use Smaller Model (Code Change)

Edit classifier/config.py to use a smaller model if available.

Option C: Run with Priority

# Run Python with higher priority
Start-Process python -ArgumentList "app.py" -WindowStyle Normal -Wait

Checking Current Virtual Memory

To see your current settings:

  1. Follow steps 1-2 above
  2. Note the current "Total paging file size" at the bottom

Typical recommendations:

  • Minimum: 1.5x your RAM
  • Recommended: 2-3x your RAM
  • For ML models: At least 8-16 GB

After Fixing

Once virtual memory is increased and computer is restarted:

cd "C:\Users\Tarak Jha\OneDrive - Coast to Coast Logistics\Desktop\HEALTHBOT\health-query-classifier"
python app.py

The models should load successfully!