Single Entry Point Design - One command for everything: train, test, and deploy!
# Full pipeline: Train → Test → Interactive
python main.py --full-pipeline --real-world
# Individual modes
python main.py --real-world # Train only (default)
python main.py --test # Test trained model
python main.py --interactive # Interactive terminal| Command | Description |
|---|---|
python main.py --real-world |
Train robust model with overfitting fixes |
python main.py --test |
Run comprehensive testing suite |
python main.py --interactive |
Start interactive NER interface |
python main.py --full-pipeline --real-world |
Complete workflow |
project_b/
├── main.py # 🎯 SINGLE ENTRY POINT
├── tools/ # Testing & interaction utilities
│ ├── test_model_comprehensive.py # Comprehensive testing suite
│ └── interactive_ner.py # Interactive terminal interface
├── model.py # Model architecture
├── train.py # Training utilities
├── utils.py # Data processing
├── evaluate.py # Evaluation metrics
└── advanced_real_world_training.py # Overfitting fixes
python main.py --real-world --epochs 8 --batch-size 8 --learning-rate 1.5e-5Fixes Applied:
- ✅ Surface pattern corruption (breaks @ .com memorization)
- ✅ Realistic targets: EMAIL 85-90%, PHONE 82-88%, PERSON 88-94%
- ✅ Stronger regularization (weight_decay 0.02, label_smoothing 0.1)
- ✅ More frequent evaluation (every 100 steps)
python main.py # Basic training
python main.py --epochs 4 # Custom epochs
python main.py --batch-size 16 # Custom batch sizepython main.py --testTests Include:
- ✅ Basic entity recognition (PER, ORG, LOC, MISC)
- ✅ EMAIL/PHONE detection accuracy
- ✅ Overfitting detection (corrupted patterns)
- ✅ Edge cases (empty text, long sequences, special chars)
- ✅ Performance analysis with 80% success threshold
Output: model_test_report.json with detailed results
python main.py --interactiveFeatures:
- 🎨 Colored entity highlighting
- ⚡ Real-time processing with timing
- 📊 Built-in commands:
help,examples,stats,test - 🛡️ Safety checks (requires testing first)
python main.py --full-pipeline --real-worldWorkflow:
- Training - Robust real-world training with overfitting fixes
- Testing - Comprehensive validation (must pass ≥80%)
- Interactive - Deploy only if testing passes
| Entity Type | Target F1 | Note |
|---|---|---|
| 85-90% | Not 99%+ (overfitting) | |
| PHONE | 82-88% | Not 99%+ (overfitting) |
| PERSON | 88-94% | Not 99%+ (overfitting) |
| OVERALL | 86-92% | Not 98%+ (overfitting) |
# Custom model
python main.py --model roberta-base --real-world
# More synthetic data
python main.py --synthetic-count 10000 --real-world
# Quick test run
python main.py --epochs 2 --batch-size 4main.py- Central orchestrator, single entry pointtools/- Separate but integrated utilitiesproduction-ner-model-final/- Trained model outputcheckpoints/- Training checkpointsmlruns/- MLflow experiment tracking
- Train:
python main.py --real-world - Validate:
python main.py --test(≥80% required) - Deploy:
python main.py --interactive
Safety: Interactive mode requires testing completion first!