Spaces:
Runtime error
Runtime error
Commit Β·
b71b25c
1
Parent(s): 236d9fb
perf: force ST to CUDA, disable LLM tasks, reduce to 100k steps
Browse files- app.py +20 -1
- configs/training_config.yaml +3 -3
app.py
CHANGED
|
@@ -105,6 +105,25 @@ def _training_thread():
|
|
| 105 |
api = HfApi(token=HF_TOKEN)
|
| 106 |
api.create_repo(repo_id=HF_REPO, repo_type="model", exist_ok=True)
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
# ββ Patch env for simulate_specialists ββββββββββββββ
|
| 109 |
_log("Loading environment...")
|
| 110 |
from env.spindleflow_env import SpindleFlowEnv
|
|
@@ -286,7 +305,7 @@ def _training_thread():
|
|
| 286 |
)
|
| 287 |
periodic_push = PeriodicHubPush(
|
| 288 |
api=api, hf_repo=HF_REPO, hf_token=HF_TOKEN,
|
| 289 |
-
vec_env=vec_env, push_every=
|
| 290 |
)
|
| 291 |
|
| 292 |
model.learn(
|
|
|
|
| 105 |
api = HfApi(token=HF_TOKEN)
|
| 106 |
api.create_repo(repo_id=HF_REPO, repo_type="model", exist_ok=True)
|
| 107 |
|
| 108 |
+
# ββ Force SentenceTransformer onto CUDA βββββββββββββ
|
| 109 |
+
# encode() is called every step (scratchpad) + per specialist call.
|
| 110 |
+
# On CPU this costs ~250 ms/call β ~1 s/step. On CUDA it's ~10 ms.
|
| 111 |
+
_log("Patching SentenceTransformer to CUDA...")
|
| 112 |
+
import torch as _torch_st
|
| 113 |
+
if _torch_st.cuda.is_available():
|
| 114 |
+
try:
|
| 115 |
+
from sentence_transformers import SentenceTransformer as _ST
|
| 116 |
+
_orig_st_init = _ST.__init__
|
| 117 |
+
def _fast_st_init(self, *args, **kwargs):
|
| 118 |
+
kwargs.setdefault("device", "cuda")
|
| 119 |
+
_orig_st_init(self, *args, **kwargs)
|
| 120 |
+
_ST.__init__ = _fast_st_init
|
| 121 |
+
_log("SentenceTransformer β cuda β")
|
| 122 |
+
except Exception as _ep:
|
| 123 |
+
_log(f"ST patch skipped: {_ep}")
|
| 124 |
+
else:
|
| 125 |
+
_log("WARNING: CUDA not available for SentenceTransformer β CPU mode (slow)")
|
| 126 |
+
|
| 127 |
# ββ Patch env for simulate_specialists ββββββββββββββ
|
| 128 |
_log("Loading environment...")
|
| 129 |
from env.spindleflow_env import SpindleFlowEnv
|
|
|
|
| 305 |
)
|
| 306 |
periodic_push = PeriodicHubPush(
|
| 307 |
api=api, hf_repo=HF_REPO, hf_token=HF_TOKEN,
|
| 308 |
+
vec_env=vec_env, push_every=10_000,
|
| 309 |
)
|
| 310 |
|
| 311 |
model.learn(
|
configs/training_config.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
training:
|
| 2 |
seed: 42
|
| 3 |
-
total_timesteps:
|
| 4 |
-
n_envs:
|
| 5 |
device: "auto" # "cuda" if available, else "cpu"
|
| 6 |
|
| 7 |
ppo:
|
|
@@ -71,7 +71,7 @@ environment:
|
|
| 71 |
sector:
|
| 72 |
name: "software_engineering" # Change this to switch domains
|
| 73 |
description: "Software product development including frontend, backend, databases, devops, and security"
|
| 74 |
-
use_llm_task_generation:
|
| 75 |
llm_task_model: "gpt-4o-mini"
|
| 76 |
task_cache_size: 200 # Large cache reduces refill frequency; background thread handles refills
|
| 77 |
# Technology stack injected into ambiguous task descriptions by TaskDecomposer.
|
|
|
|
| 1 |
training:
|
| 2 |
seed: 42
|
| 3 |
+
total_timesteps: 100000
|
| 4 |
+
n_envs: 1
|
| 5 |
device: "auto" # "cuda" if available, else "cpu"
|
| 6 |
|
| 7 |
ppo:
|
|
|
|
| 71 |
sector:
|
| 72 |
name: "software_engineering" # Change this to switch domains
|
| 73 |
description: "Software product development including frontend, backend, databases, devops, and security"
|
| 74 |
+
use_llm_task_generation: false # Set false to fall back to catalog-derived tasks
|
| 75 |
llm_task_model: "gpt-4o-mini"
|
| 76 |
task_cache_size: 200 # Large cache reduces refill frequency; background thread handles refills
|
| 77 |
# Technology stack injected into ambiguous task descriptions by TaskDecomposer.
|