IDP-Machine-learning / test_mutex_fix.py
mrrobot2610's picture
Initial commit: IDP (Intelligent Document Processing) System
1a7ee60
Raw History Blame Contribute Delete
806 Bytes
#!/usr/bin/env python3
"""
Quick test to verify mutex lock fix
"""
# Fix for TensorFlow/PaddlePaddle mutex warnings on macOS
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['OPENBLAS_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
os.environ['VECLIB_MAXIMUM_THREADS'] = '1'
os.environ['NUMEXPR_NUM_THREADS'] = '1'
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import warnings
warnings.filterwarnings('ignore')
print("Testing PaddleOCR import...")
from paddleocr import PaddleOCR
print("✓ PaddleOCR imported successfully without mutex warnings!")
print("\nInitializing PaddleOCR...")
ocr = PaddleOCR(lang='en', use_angle_cls=True)
print("✓ PaddleOCR initialized successfully!")
print("\n✅ All tests passed! The mutex lock issue is fixed.")