File size: 1,261 Bytes
ad6d315 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import sys
import os
# Add the current directory to sys.path so we can import backend
sys.path.append(os.getcwd())
print("Importing backend.model_handler...", flush=True)
from backend.model_handler import model_handler
print("\nChecking model states...", flush=True)
errors = []
if model_handler.model_int is not None:
errors.append("InternVL model should be None on startup")
else:
print("PASS: InternVL model is None")
if model_handler.tokenizer_int is not None:
errors.append("InternVL tokenizer should be None on startup")
else:
print("PASS: InternVL tokenizer is None")
if model_handler.reader is not None:
errors.append("EasyOCR reader should be None on startup")
else:
print("PASS: EasyOCR reader is None")
if model_handler.model_clip is not None:
errors.append("CLIP model should be None on startup")
else:
print("PASS: CLIP model is None")
if model_handler.processor_clip is not None:
errors.append("CLIP processor should be None on startup")
else:
print("PASS: CLIP processor is None")
if errors:
print("\nFAILED:", flush=True)
for error in errors:
print(f"- {error}", flush=True)
sys.exit(1)
else:
print("\nSUCCESS: All models are lazily loaded.", flush=True)
sys.exit(0)
|