Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- inference.py +9 -9
inference.py
CHANGED
|
@@ -31,17 +31,17 @@ API_BASE_URL = os.getenv("API_BASE_URL") or "https://router.huggingface.co/v1"
|
|
| 31 |
MODEL_NAME = os.getenv("MODEL_NAME") or "Qwen/Qwen2.5-72B-Instruct"
|
| 32 |
SERVER_URL = os.getenv("SERVER_URL", "http://localhost:7860")
|
| 33 |
SEED = 42
|
| 34 |
-
MAX_TOKENS =
|
| 35 |
TEMPERATURE = 0.0
|
| 36 |
-
LLM_TIMEOUT =
|
| 37 |
|
| 38 |
-
# Per-task wall-clock budget. Once elapsed > budget -
|
| 39 |
-
#
|
| 40 |
-
#
|
| 41 |
TASK_BUDGET_S = {
|
| 42 |
-
"basic_flow":
|
| 43 |
-
"emergency_priority":
|
| 44 |
-
"dynamic_scenarios":
|
| 45 |
}
|
| 46 |
|
| 47 |
TASK_MAX_STEPS = {"basic_flow": 200, "emergency_priority": 300, "dynamic_scenarios": 400}
|
|
@@ -357,7 +357,7 @@ def run_task(task: str, client: OpenAI) -> dict:
|
|
| 357 |
pass
|
| 358 |
|
| 359 |
elapsed = time.time() - task_start
|
| 360 |
-
force_heuristic = elapsed > budget_s -
|
| 361 |
|
| 362 |
action, source = get_action(
|
| 363 |
client, obs, step, task, history, state, force_heuristic
|
|
|
|
| 31 |
MODEL_NAME = os.getenv("MODEL_NAME") or "Qwen/Qwen2.5-72B-Instruct"
|
| 32 |
SERVER_URL = os.getenv("SERVER_URL", "http://localhost:7860")
|
| 33 |
SEED = 42
|
| 34 |
+
MAX_TOKENS = 80 # brief CoT + JSON line — minimises latency
|
| 35 |
TEMPERATURE = 0.0
|
| 36 |
+
LLM_TIMEOUT = 4 # per-call hard timeout (seconds)
|
| 37 |
|
| 38 |
+
# Per-task wall-clock budget. Once elapsed > budget - 45s, force pure heuristic.
|
| 39 |
+
# Total: 240+360+480 = 1080s = 18 min — safely under the 20-min kill limit.
|
| 40 |
+
# Expected with ~1s avg per LLM call: 900s = 15 min.
|
| 41 |
TASK_BUDGET_S = {
|
| 42 |
+
"basic_flow": 240,
|
| 43 |
+
"emergency_priority": 360,
|
| 44 |
+
"dynamic_scenarios": 480,
|
| 45 |
}
|
| 46 |
|
| 47 |
TASK_MAX_STEPS = {"basic_flow": 200, "emergency_priority": 300, "dynamic_scenarios": 400}
|
|
|
|
| 357 |
pass
|
| 358 |
|
| 359 |
elapsed = time.time() - task_start
|
| 360 |
+
force_heuristic = elapsed > budget_s - 45
|
| 361 |
|
| 362 |
action, source = get_action(
|
| 363 |
client, obs, step, task, history, state, force_heuristic
|