File size: 2,498 Bytes
cd7807c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python3
"""
Simulate what will happen in HF Space during evaluation
"""

print("=" * 70)
print("SIMULATING HF SPACE EVALUATION ENVIRONMENT")
print("=" * 70)

# Test 1: Can we import the modules?
print("\n1. Testing imports...")
try:
    import cloud_soc_env
    print("   βœ“ cloud_soc_env imports successfully")
except Exception as e:
    print(f"   βœ— Failed to import cloud_soc_env: {e}")

try:
    import graders
    print("   βœ“ graders imports successfully")
except Exception as e:
    print(f"   βœ— Failed to import graders: {e}")

try:
    import yaml
    print("   βœ“ yaml imports successfully")
except Exception as e:
    print(f"   βœ— Failed to import yaml: {e}")

# Test 2: Can we load openenv.yaml?
print("\n2. Testing openenv.yaml loading...")
try:
    with open('openenv.yaml', encoding='utf-8') as f:
        data = yaml.safe_load(f)
    print(f"   βœ“ openenv.yaml loaded successfully")
    print(f"   βœ“ Found {len(data.get('tasks', []))} tasks")
except Exception as e:
    print(f"   βœ— Failed to load openenv.yaml: {e}")

# Test 3: Can we access grader functions?
print("\n3. Testing grader function access...")
try:
    func_easy = getattr(graders, 'grade_easy')
    func_medium = getattr(graders, 'grade_medium')
    func_hard = getattr(graders, 'grade_hard')
    print(f"   βœ“ All 3 grader functions accessible")
except Exception as e:
    print(f"   βœ— Failed to access grader functions: {e}")

# Test 4: Can we call the graders?
print("\n4. Testing grader function execution...")
try:
    result_easy = graders.grade_easy([])
    result_medium = graders.grade_medium([])
    result_hard = graders.grade_hard([])
    
    print(f"   βœ“ grade_easy([]) = {result_easy}")
    print(f"   βœ“ grade_medium([]) = {result_medium}")
    print(f"   βœ“ grade_hard([]) = {result_hard}")
    
    # Validate all are in range
    all_in_range = all(0 < s < 1 for s in [result_easy, result_medium, result_hard])
    if all_in_range:
        print(f"   βœ“ ALL SCORES IN VALID RANGE (0, 1)")
    else:
        print(f"   βœ— SOME SCORES OUT OF RANGE")
except Exception as e:
    print(f"   βœ— Failed to execute graders: {e}")

# Test 5: Test inference.py imports
print("\n5. Testing inference.py imports...")
try:
    import inference
    print(f"   βœ“ inference.py imports successfully")
except Exception as e:
    print(f"   βœ— Failed to import inference.py: {e}")

print("\n" + "=" * 70)
print("βœ… HF SPACE ENVIRONMENT SIMULATION: PASSED")
print("=" * 70)