File size: 1,053 Bytes
5c58259
 
 
 
 
 
 
 
 
 
33278a3
 
5c58259
 
 
33278a3
 
 
 
 
 
 
 
 
 
 
5c58259
 
 
 
 
 
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
from catboost import CatBoostClassifier
import os

def test_model_loading():
    possible_paths = [
        os.path.join(os.getcwd(), "catboost_model.bin"),
        "/app/catboost_model.bin",
        "catboost_model.bin"
    ]
    
    formats_to_try = [None, 'binnar', 'json', 'coreml']
    
    for path in possible_paths:
        if os.path.exists(path):
            print(f"Found model at: {path}")
            for format in formats_to_try:
                model = CatBoostClassifier()
                try:
                    if format is None:
                        model.load_model(path)
                    else:
                        model.load_model(path, format=format)
                    print(f"Successfully loaded model from {path} with format {format}")
                    return True
                except Exception as e:
                    print(f"Failed to load from {path} with format {format}: {str(e)}")
    
    print("Model not found in any location")
    return False

if __name__ == "__main__":
    test_model_loading()