Spaces:
Sleeping
Sleeping
OpenEnv Contributor
fix: update score range to 0.1-0.9 per hackathon spec, add inference tests, update validator
cd7807c | #!/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) | |