Spaces:
Sleeping
Sleeping
| import os | |
| import json | |
| import yaml | |
| import requests | |
| import subprocess | |
| import time | |
| def check_structure(): | |
| print("--- 1. Structure Check ---") | |
| files = ["openenv.yaml", "inference.py", "env.py", "main.py", "Dockerfile", "requirements.txt"] | |
| for f in files: | |
| if os.path.exists(f): | |
| print(f"β Found {f}") | |
| else: | |
| print(f"β Missing {f} (MANDATORY)") | |
| def check_yaml(): | |
| print("\n--- 2. Spec Validation ---") | |
| try: | |
| with open("openenv.yaml", "r") as f: | |
| data = yaml.safe_load(f) | |
| if data.get("openenv_v") and data.get("tasks"): | |
| print("β openenv.yaml is valid") | |
| print(f"β Found {len(data['tasks'])} tasks (Minimum 3 required)") | |
| else: | |
| print("β openenv.yaml is missing required fields") | |
| except Exception as e: | |
| print(f"β YAML Error: {e}") | |
| def check_logs(): | |
| print("\n--- 3. Inference Log Check ---") | |
| # We will simulate a quick run of inference.py and check the first/last lines | |
| # This requires the server to be running. For this check, we'll verify the code pattern. | |
| with open("inference.py", "r") as f: | |
| content = f.read() | |
| if "[START]" in content and "[STEP]" in content and "[END]" in content: | |
| print("β inference.py uses correct log tags") | |
| if "OpenAI(" in content: | |
| print("β Found OpenAI Client usage") | |
| else: | |
| print("β Missing OpenAI Client usage (REQIURED)") | |
| def check_reward_scaling(): | |
| print("\n--- 4. Reward Scaling Check ---") | |
| with open("env.py", "r") as f: | |
| env_content = f.read() | |
| if "reward += 0." in env_content or "reward -= 0." in env_content: | |
| print("β Logic appears to use 0.0-1.0 normalized rewards") | |
| else: | |
| print("β οΈ Warning: Could not confirm normalized rewards automatically. Double check env.py.") | |
| if __name__ == "__main__": | |
| check_structure() | |
| check_yaml() | |
| check_logs() | |
| check_reward_scaling() | |
| print("\nπ Validation Simulation Complete. If all above are green, you are ready!") | |