Mihir Mungara commited on
Commit
b95eda5
·
1 Parent(s): 3d8d49f

once again changed logic for clamping reward b/w 0 and 1

Browse files
Files changed (1) hide show
  1. inference.py +3 -2
inference.py CHANGED
@@ -203,7 +203,7 @@ def run_task(
203
 
204
  except Exception as e:
205
  last_error = str(e)
206
- reward = 0.0
207
  rewards.append(reward)
208
  done = True
209
 
@@ -211,7 +211,8 @@ def run_task(
211
  action_str = format_action_str(action.operation, action.parameters)
212
  error_str = last_error if last_error else "null"
213
  done_str = "true" if done else "false"
214
- print(f"[STEP] step={step} action={action_str} reward={reward:.2f} done={done_str} error={error_str}")
 
215
 
216
  if done:
217
  success = reward > 0.5 # Consider success if final reward > 0.5
 
203
 
204
  except Exception as e:
205
  last_error = str(e)
206
+ reward = 0.0001
207
  rewards.append(reward)
208
  done = True
209
 
 
211
  action_str = format_action_str(action.operation, action.parameters)
212
  error_str = last_error if last_error else "null"
213
  done_str = "true" if done else "false"
214
+ safe_reward = max(0.0001, min(0.9999, reward))
215
+ print(f"[STEP] step={step} action={action_str} reward={safe_reward:.4f} done={done_str} error={error_str}")
216
 
217
  if done:
218
  success = reward > 0.5 # Consider success if final reward > 0.5