Spaces:
Sleeping
Sleeping
improve: better prompt + fixed grader normalization, score 0.77
Browse filesFiles changed (6)
- Dockerfile+1-1
- README.md+2-2
- inference.py+5-3
- openenv.yaml+1-1
- tasks/grader.py+6-1
- test_api.jsonAdded+1
20 unmodified lines212223242425262720 unmodified lines
# Environment variables (override at runtime)ENV API_BASE_URL="https://router.huggingface.co/v1" \ MODEL_NAME="mistralai/Mistral-7B-Instruct-v0.3" \ MODEL_NAME="meta-llama/Meta-Llama-3-8B-Instruct" \ HF_TOKEN=""
# Run via gunicorn (production-grade)95 unmodified lines96979899991001011029 unmodified lines11211311411511511611711895 unmodified linesdocker run -p 5000:5000 \ -e HF_TOKEN=your_token \ -e MODEL_NAME=mistralai/Mistral-7B-Instruct-v0.3 \ -e API_BASE_URL=https://router.huggingface.co/v1 \ -e API_BASE_URL=https://router.huggingface.co/hf-inference/v1 \ sentinel-env```
9 unmodified lines```bashexport HF_TOKEN=your_tokenexport MODEL_NAME=mistralai/Mistral-7B-Instruct-v0.3export API_BASE_URL=https://router.huggingface.co/v1export API_BASE_URL=https://router.huggingface.co/hf-inference/v1python inference.py```
4 unmodified lines56788910118 unmodified lines202122232324252627283 unmodified lines32333433353637384 unmodified linesfrom env.models import Action
API_BASE_URL = os.environ.get("API_BASE_URL", "https://router.huggingface.co/v1")MODEL_NAME = os.environ.get("MODEL_NAME", "mistralai/Mistral-7B-Instruct-v0.3")MODEL_NAME = os.environ.get("MODEL_NAME", "meta-llama/Meta-Llama-3-8B-Instruct")HF_TOKEN = os.environ.get("HF_TOKEN", "")
client = OpenAI(base_url=API_BASE_URL, api_key=HF_TOKEN)8 unmodified lines f" - {t.id} | priority={t.priority} | active={t.active}" for t in obs.targets if t.active ) return f"""You are a sensor allocation agent. Assign ONE sensor to ONE target. return f"""You are a sensor allocation agent. Assign ONE available sensor to the HIGHEST priority active target.Always pick priority 3 targets first, then priority 2, then priority 1.Never pick already-handled targets.
Timestep: {obs.timestep}
3 unmodified linesActive Targets (priority: 3=high, 2=medium, 1=low):{targets}
Respond ONLY with valid JSON in this exact format:Respond ONLY with valid JSON, no explanation:{{"sensor_id": "<sensor_id>", "target_id": "<target_id>"}}"""
4 unmodified lines5678894 unmodified linesMODEL_PATH: "/app/models/sensor_rl_model.pkl"API_KEYS: "mock_key_alpha,mock_key_bravo"API_BASE_URL: "https://router.huggingface.co/v1"MODEL_NAME: "mistralai/Mistral-7B-Instruct-v0.3"MODEL_NAME: "meta-llama/Meta-Llama-3-8B-Instruct"HF_TOKEN: ""45 unmodified lines4647484950515253495455565745 unmodified lines """Normalize a single episode's total reward into a [0.0, 1.0] score.""" if steps <= 0: return 0.0 # Best possible: +10 per step (hit p3, no misses) # Worst possible: -12 per step (-2 idle penalty) best = steps * 10.0 worst = steps * -12.0 normalized = (total_reward - worst) / (best - worst) return round(max(0.0, min(1.0, total_reward / (steps * 10))), 4) return round(max(0.0, min(1.0, normalized)), 4)
def grade_summary(episode_log: list[dict]) -> dict:1{"model": "Qwen/Qwen2.5-72B-Instruct", "messages": [{"role": "user", "content": "say hi"}], "max_tokens": 10}Dockerfile+1-1
README.md+2-2
inference.py+5-3
openenv.yaml+1-1
tasks/grader.py+6-1
test_api.jsonAdded+1