77ethers commited on
Commit
bfb3f8a
·
verified ·
1 Parent(s): b4bf396

Upload inference.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. inference.py +3 -3
inference.py CHANGED
@@ -127,9 +127,9 @@ def run_task(client: OpenAI, env: GridOpsEnvironment, task_id: str, seed: int =
127
 
128
  action_dict = parse_action(reply)
129
  action = GridOpsAction(
130
- battery_dispatch=float(action_dict.get("battery_dispatch", 0.0)),
131
- diesel_dispatch=float(action_dict.get("diesel_dispatch", 0.0)),
132
- demand_shedding=float(action_dict.get("demand_shedding", 0.0)),
133
  )
134
  obs = env.step(action)
135
  obs_dict = obs.model_dump()
 
127
 
128
  action_dict = parse_action(reply)
129
  action = GridOpsAction(
130
+ battery_dispatch=max(-1.0, min(1.0, float(action_dict.get("battery_dispatch", 0.0)))),
131
+ diesel_dispatch=max(0.0, min(1.0, float(action_dict.get("diesel_dispatch", 0.0)))),
132
+ demand_shedding=max(0.0, min(1.0, float(action_dict.get("demand_shedding", 0.0)))),
133
  )
134
  obs = env.step(action)
135
  obs_dict = obs.model_dump()