Spaces:
Sleeping
Sleeping
ping98k
commited on
Commit
·
1d9f28c
1
Parent(s):
2c7a71f
Update main.py
Browse files
main.py
CHANGED
|
@@ -8,7 +8,7 @@ from tournament_utils import generate_players, prompt_score, prompt_pairwise
|
|
| 8 |
|
| 9 |
NUM_TOP_PICKS_DEFAULT = int(os.getenv("NUM_TOP_PICKS", 3))
|
| 10 |
POOL_SIZE_DEFAULT = int(os.getenv("POOL_SIZE", 5))
|
| 11 |
-
MAX_WORKERS_DEFAULT = int(os.getenv("MAX_WORKERS",
|
| 12 |
NUM_GENERATIONS_DEFAULT = int(os.getenv("NUM_GENERATIONS", 10))
|
| 13 |
API_BASE_DEFAULT = os.getenv("OPENAI_API_BASE", "")
|
| 14 |
API_TOKEN_DEFAULT = os.getenv("OPENAI_API_KEY", "")
|
|
@@ -133,6 +133,7 @@ def run_tournament(
|
|
| 133 |
return sum(vals) / len(vals) if vals else 0.0
|
| 134 |
return float(data.get("score", 0))
|
| 135 |
|
|
|
|
| 136 |
with ThreadPoolExecutor(max_workers=max_workers) as ex:
|
| 137 |
scores = {
|
| 138 |
p: s
|
|
@@ -214,6 +215,7 @@ def run_tournament(
|
|
| 214 |
candidates = list(set(finalists + semifinalists + get_candidates(champion, lost_to)))
|
| 215 |
return playoff(candidates, executor)[:num_top_picks]
|
| 216 |
|
|
|
|
| 217 |
with ThreadPoolExecutor(max_workers=max_workers) as ex:
|
| 218 |
top_k = get_top(top_players, ex)
|
| 219 |
for i, txt in enumerate(pairwise_outputs, 1):
|
|
|
|
| 8 |
|
| 9 |
NUM_TOP_PICKS_DEFAULT = int(os.getenv("NUM_TOP_PICKS", 3))
|
| 10 |
POOL_SIZE_DEFAULT = int(os.getenv("POOL_SIZE", 5))
|
| 11 |
+
MAX_WORKERS_DEFAULT = int(os.getenv("MAX_WORKERS", 100))
|
| 12 |
NUM_GENERATIONS_DEFAULT = int(os.getenv("NUM_GENERATIONS", 10))
|
| 13 |
API_BASE_DEFAULT = os.getenv("OPENAI_API_BASE", "")
|
| 14 |
API_TOKEN_DEFAULT = os.getenv("OPENAI_API_KEY", "")
|
|
|
|
| 133 |
return sum(vals) / len(vals) if vals else 0.0
|
| 134 |
return float(data.get("score", 0))
|
| 135 |
|
| 136 |
+
yield from log("Histogram generating")
|
| 137 |
with ThreadPoolExecutor(max_workers=max_workers) as ex:
|
| 138 |
scores = {
|
| 139 |
p: s
|
|
|
|
| 215 |
candidates = list(set(finalists + semifinalists + get_candidates(champion, lost_to)))
|
| 216 |
return playoff(candidates, executor)[:num_top_picks]
|
| 217 |
|
| 218 |
+
yield from log("Pairwise generating")
|
| 219 |
with ThreadPoolExecutor(max_workers=max_workers) as ex:
|
| 220 |
top_k = get_top(top_players, ex)
|
| 221 |
for i, txt in enumerate(pairwise_outputs, 1):
|