PerplexityViewer / QUICKSTART.md
Bram van Es
bla
ef12530

A newer version of the Gradio SDK is available: 6.1.0

Upgrade

πŸš€ Quick Start Guide

Installation & Launch (3 steps)

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Launch the app:

    python launch.py
    
  3. Open your browser to http://localhost:7860

Alternative Launch Methods

If the above doesn't work, try these:

# Method 1: Full startup script
python run.py

# Method 2: Direct app launch
python app.py

# Method 3: With dependency installation
python run.py --install

First Time Usage

  1. Enter text in the input box (try: "The quick brown fox jumps over the lazy dog.")
  2. Select a model (default: gpt2)
  3. Choose model type (decoder for GPT-like, encoder for BERT-like)
  4. Click "Analyze"

You'll see:

  • 🟒 Green tokens = Low perplexity (model is confident)
  • πŸ”΄ Red tokens = High perplexity (model is uncertain)

Troubleshooting

Common Issues:

  • "Module not found" β†’ Run: pip install -r requirements.txt
  • "Model download failed" β†’ Check internet connection
  • "Launch failed" β†’ Try: python launch.py or python app.py
  • Out of memory β†’ Use smaller models like distilgpt2 or distilbert-base-uncased

GPU Support:

  • Automatically uses GPU if available
  • Falls back to CPU if no GPU found

Example Models to Try

Decoder (GPT-like):

  • gpt2 - Standard GPT-2
  • distilgpt2 - Smaller, faster
  • microsoft/DialoGPT-small - Conversational

Encoder (BERT-like):

  • bert-base-uncased - Standard BERT
  • distilbert-base-uncased - Smaller, faster
  • roberta-base - Improved BERT

Need Help?

Run the test suite:

python test_app.py

Or try the command-line demo:

python demo.py

Still having issues? Check the full README.md for detailed instructions.

βœ… Recent Updates

Ultra-Simplified Interface!

  • Removed MLM probability slider for cleaner interface
  • Removed iterations slider - single comprehensive analysis per run
  • Encoder models now analyze all tokens for complete results
  • Decoder models provide single-pass perplexity calculation
  • Tokens are properly colored by perplexity (green=confident, red=uncertain)
  • If you see black/white tokens, try refreshing the browser
  • Test the colors with: python simple_color_test.py (creates color_test.html)