14 Commits

Author SHA1 Message Date
7dcada5617 convert to multi-GPU submission (Biren/Cambricon/MetaX) with fresh filtered model lists 2026-07-29 14:26:16 +08:00
5958df93b0 switch to Cambricon_mlu-370-x8 with new model list, refresh AUTH_TOKEN 2026-07-27 16:46:41 +08:00
a73274e6a4 switch back to ppu_zw_810e with new model list 2026-07-23 14:27:36 +08:00
b3c577219f switch to Biren_166m GPU with new model list 2026-07-22 13:53:23 +08:00
1591b3050e refresh expired AUTH_TOKEN 2026-07-21 18:56:31 +08:00
55c77faa70 update model list 2026-07-21 18:42:47 +08:00
e51533e0bf update model list
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 16:58:36 +08:00
4e603b9fb0 update 2026-07-14 19:06:47 +08:00
5fe8bf27e5 update main.py
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 18:41:06 +08:00
d6b0e416db update ppu 2026-07-13 19:43:35 +08:00
4dcfed6b6d update ppu 2026-07-13 18:38:55 +08:00
1e8cfacd8e uodate 2026-06-22 19:00:46 +08:00
d6cca90496 update main.py 2026-06-22 18:44:42 +08:00
031e0dc7a8 update main.py 2026-06-19 01:48:50 +08:00
3 changed files with 189 additions and 62 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.DS_Store
__pycache__/

View File

@@ -1,6 +1,7 @@
FROM modelhubxc-4pd.tencentcloudcr.com/xc_agent_platform/python:3.11-slim
ENV PYTHONUNBUFFERED=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app

246
main.py
View File

@@ -1,7 +1,9 @@
"""
xc_validation_strategy — 主入口
启动后执行一次模型验证任务批量提交,之后保持 HTTP 服务存活。
启动后针对 3 张 GPU 卡Biren_166m / Cambricon_mlu-370-x8 / MetaX_c-500
分别批量提交各自筛选出的模型验证任务(/adminApi/async/task/create-contest-task
Bearer Token 认证),之后保持 HTTP 服务存活。
同时暴露 /healthK8s 探活)和 /status运行状态
"""
@@ -22,10 +24,9 @@ BASE_URL = os.environ.get("BASE_URL", "https://modelhub.org.cn")
SUBMIT_ENDPOINT = "/adminApi/async/task/create-contest-task"
# 通过 curl -X POST https://modelhub.org.cn/adminApi/user/login 获取后填入
AUTH_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyQWNjb3VudCI6Inpob3VzaGFzaGEiLCJpZCI6MTQsInVzZXJSb2xlIjoibGVhZGVyYm9hcmQiLCJleHAiOjE3ODE4NTE0NzcsImlhdCI6MTc4MTI0NjY3N30.p3uvCpG50aLNifNVVXxvzmWJahbLM5K1671FVCtj8E8"
AUTH_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyQWNjb3VudCI6Inpob3VzaGFzaGEiLCJpZCI6MTQsInVzZXJSb2xlIjoibGVhZGVyYm9hcmQiLCJleHAiOjE3ODU3NDY3NTMsImlhdCI6MTc4NTE0MTk1M30.KwUuefNAFSNwq3_Pnaw2nef8ZC6WgsECQ_LMeQnKk2c"
CONTEST_API_TOKEN = "ef1ef82f3c9efee413d602345fbe224d"
CONTRIBUTORS = "zhoushasha"
GPU_TYPE = "Cambricon_mlu-370-x8"
TASK_TYPE = "text-generation"
STRATEGY_ID = os.environ.get("STRATEGY_ID", "") # 平台自动注入,无需修改
@@ -33,50 +34,107 @@ HTTP_HOST = "0.0.0.0"
HTTP_PORT = 8080
# ══════════════════════════════════════════════════════════
# 模型列表
# 各 GPU 的模型列表(来自 filter_verified_models 脚本的筛选结果)
# ══════════════════════════════════════════════════════════
ALL_MODEL_IDS = [
"l3utterfly/mistral-7b-v0.1-layla-v4",
"OpenBuddy/openbuddy-mistral-7b-v13.1",
"allenai/truthfulqa-info-judge-llama2-7B",
"l3utterfly/mistral-7b-v0.1-layla-v1",
"l3utterfly/minima-3b-layla-v2",
"l3utterfly/tinyllama-1.1b-layla-v4",
"l3utterfly/mistral-7b-v0.1-layla-v2",
"l3utterfly/tinyllama-1.1b-layla-v1",
"Duxiaoman-DI/XuanYuan-13B-Chat",
"l3utterfly/minima-3b-layla-v1",
"AI-ModelScope/gemma-2-2b",
"baichuan-inc/Baichuan-13B-Base",
"LGAI-EXAONE/EXAONE-Deep-2.4B",
"NousResearch/DeepHermes-3-Llama-3-3B-Preview",
"Fengshenbang/Ziya2-13B-Base",
"prithivMLmods/QwQ-MathOct-7B",
"l3utterfly/phi-2-layla-v1-chatml",
"argilla/notus-7b-v1",
"prithivMLmods/Doopler-Augment-3B-Cox",
"prithivMLmods/Blaze.1-32B-Instruct",
"CohereLabs/aya-expanse-8B",
"Magpie-Align/MagpieLM-4B-SFT-v0.1",
"Magpie-Align/MagpieLM-8B-SFT-v0.1",
"Magpie-Align/Llama-3-8B-Magpie-Align-SFT-v0.2",
"Magpie-Align/MagpieLM-8B-Chat-v0.1",
"Magpie-Align/Llama-3.1-8B-Magpie-Align-SFT-v0.1",
"Magpie-Align/Llama-3-8B-Magpie-Air-SFT-300K-v0.1",
"prithivMLmods/Tulu-MathLingo-8B",
"prithivMLmods/Triangulum-5B",
"prithivMLmods/Viper-Coder-v0.1",
BIREN_MODELS = [
"BigRatz/LOL-AI-2026",
"aimeri/spoomplesmaxx-cardmaker-v1",
"Alibaba-DT/Logics-STEM-8B-SFT",
"Muneebmn123/insurance-voice-qwen25-1_5b",
"AnkitBirGurung/NEMO-12B-SFT-Further",
"danilarudenko/editorai-mini",
"EphemeralYou/Prompt-Refine-MiniCPM5-1B",
"mtepe01/mentorx-mistral-7b-automata-merged",
"DarkArtsForge/Helix-SCE-12B-jh",
"rpant/iolai26-solve",
"NithinAI12/NithinX-Omni-LLM-v1",
"ConvexAI/Luminex-34B-v0.2",
"codellama/CodeLlama-34b-hf",
"Lipas007/iol-ai-2026-qwen14b-awq",
"D-Z-W/finetuned-teacher",
"huan1999/ziya-llama-13b-medical-merged",
"codellama/CodeLlama-34b-Python-hf",
"ld4ad/gemma-2-9b-dunhuang",
"harindhar10/Olmo-7b_1M_Smiles_lora",
"allenai/Olmo-3-7B-Think-DPO",
"allenai/Olmo-3-32B-Think-DPO",
"RedHatAI/gemma-2-9b-it",
"prashanthsura/gemma-2-2b-legal-financial-sft",
"pfnet/plamo-2-8b",
"sail/Sailor2-20B-128K-SFT",
"facebook/layerskip-llama3.2-1B",
"Qwen/Qwen2.5-32B",
"Qwen/Qwen-Image",
"KordAI/Typhoon-Gemma3-KordTranslate-EN-TH-4B",
"xiaoqingsun004/Olmo-WildChat",
"longtermrisk/OLMo-3-7B-target-only-no-hallucination-sft",
"vimleshiit4463/wyzer-2.0-smollm2-135m",
"trl-lib/pythia-1b-deduped-tldr-sft",
]
CAMBRICON_MODELS = [
"clear-blue-sky/evolai-reborn-tfm-008",
"clear-blue-sky/evolai-reborn-tfm-010",
"BigRatz/LOL-AI-2026",
"clear-blue-sky/evolai-reborn-tfm-001",
"clear-blue-sky/evolai-reborn-tfm-019",
"clear-blue-sky/evolai-reborn-tfm-007",
"aimeri/spoomplesmaxx-cardmaker-v1",
"aipatseer/inst_ft_qwen_0.6b_summ",
"clear-blue-sky/evolai-reborn-tfm-003",
"clear-blue-sky/evolai-reborn-tfm-004",
"Alibaba-DT/Logics-STEM-8B-SFT",
"clear-blue-sky/evolai-reborn-tfm-002",
"prism-ml/Ternary-Bonsai-4B-unpacked",
"Muneebmn123/insurance-voice-qwen25-1_5b",
"AnkitBirGurung/NEMO-12B-SFT-Further",
"danilarudenko/editorai-mini",
"rpant/iolai26-solve",
]
METAX_MODELS = [
"Phoenix9781/evolai-tf-model-105",
"clear-blue-sky/evolai-reborn-tfm-008",
"clear-blue-sky/evolai-reborn-tfm-010",
"BigRatz/LOL-AI-2026",
"clear-blue-sky/evolai-reborn-tfm-001",
"clear-blue-sky/evolai-reborn-tfm-019",
"clear-blue-sky/evolai-reborn-tfm-007",
"clear-blue-sky/evolai-reborn-tfm-005",
"Lin2es/evolai-tfm-03o",
"clear-blue-sky/evolai-reborn-tfm-009",
"aimeri/spoomplesmaxx-cardmaker-v1",
"aipatseer/inst_ft_qwen_0.6b_summ",
"reaperdoesntknow/DualMind-TKD-Agentic-1.7B",
"clear-blue-sky/evolai-reborn-tfm-011",
"clear-blue-sky/evolai-reborn-tfm-003",
"clear-blue-sky/evolai-reborn-tfm-004",
"clear-blue-sky/evolai-reborn-tfm-002",
"amd/ReasonLite-0.6B",
"prism-ml/Ternary-Bonsai-4B-unpacked",
"Muneebmn123/insurance-voice-qwen25-1_5b",
"danilarudenko/editorai-mini",
"rpant/iolai26-solve",
]
# 按顺序处理Biren → Cambricon → MetaX
GPU_JOBS: List[Tuple[str, List[str]]] = [
("Biren_166m", BIREN_MODELS),
("Cambricon_mlu-370-x8", CAMBRICON_MODELS),
("MetaX_c-500", METAX_MODELS),
]
TOTAL_MODELS = sum(len(models) for _, models in GPU_JOBS)
# ══════════════════════════════════════════════════════════
# 全局状态(供 /status 展示)
# ══════════════════════════════════════════════════════════
_state = {
"strategy_id": STRATEGY_ID,
"phase": "starting", # starting | submitting | done | error
"total": len(ALL_MODEL_IDS),
"total": TOTAL_MODELS,
"submitted": 0,
"failed": 0,
"per_gpu": {gpu: 0 for gpu, _ in GPU_JOBS},
"started_at": None,
"finished_at": None,
}
@@ -116,14 +174,40 @@ def _run_http():
print("[http] 已关闭", flush=True)
# ══════════════════════════════════════════════════════════
# 业务逻辑
# 各 GPU 的 config_content 模板
# ══════════════════════════════════════════════════════════
def _submit_task(token: str, model_id: str) -> Tuple[bool, str]:
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}",
}
config_content = f"""docker_image: harbor.4pd.io/hardcore-tech/cambricon-mlu370-pytorch:v25.01-torch2.5.0-torchmlu1.24.1-ubuntu22.04-py310
def build_config_content(gpu_type: str, model_id: str) -> str:
if gpu_type == "Biren_166m":
max_model_len = 4096
return f"""docker_image: git.modelhub.org.cn:9443/enginex/xc-llm-biren166m:26.01
nv_docker_image: harbor.4pd.io/dooke/vllm/vllm/vllm-openai:v0.11.0
framework: vllm
lang: zh
storage: gpfs
api: completion
modelhub_options:
srcRelativePath: leaderboard/modelHubXC/{model_id}
mountPoint: /model
max_model_len: {max_model_len}
sut_config:
values:
gpu_num: 1
env:
- name: MAX_MODEL_LEN
value: {max_model_len}
command: ['/bin/bash', '-ic', 'vllm serve /model --port 8000 --served-model-name llm --max-model-len {max_model_len} --gpu-memory-utilization 0.9 --enforce-eager --trust-remote-code -tp 1 --host 0.0.0.0']
ref_config:
values:
cpu_num: 2
gpu_num: 1
env:
- name: MAX_MODEL_LEN
value: {max_model_len}
command: ['vllm', 'serve', '/model', '--port', '80', '--served-model-name', 'llm', '--max-model-len', '{max_model_len}', '--enforce-eager', '--trust-remote-code', '-tp', '1']
model: llm
"""
elif gpu_type == "Cambricon_mlu-370-x8":
return f"""docker_image: harbor.4pd.io/hardcore-tech/cambricon-mlu370-pytorch:v25.01-torch2.5.0-torchmlu1.24.1-ubuntu22.04-py310
nv_docker_image: harbor.4pd.io/dooke/vllm/vllm/vllm-openai:v0.11.0
framework: vllm
storage: gpfs
@@ -146,21 +230,54 @@ ref_config:
value: 8192
command: ["vllm", "serve", "/model", "--port", "80", "--served-model-name", "llm", "--max-model-len", "8192", "--trust-remote-code", "--dtype", "float16"]
"""
elif gpu_type == "MetaX_c-500":
return f"""docker_image: git.modelhub.org.cn:9443/enginex-metax/vllm:0.9.1
nv_docker_image: harbor.4pd.io/dooke/vllm/vllm/vllm-openai:v0.11.0
framework: vllm
lang: en
storage: gpfs
api: chat
modelhub_options:
srcRelativePath: leaderboard/modelHubXC/{model_id}
mountPoint: /model
max_model_len: 2048
sut_config:
gpu_num: 1
values:
command: ['/opt/conda/bin/vllm', 'serve', '/model', '--port', '20644', '--served-model-name', 'llm', '--max-model-len', '2048', '--gpu-memory-utilization', '0.9', '--enforce-eager', '--trust-remote-code' ,'-tp', '1']
ref_config:
gpu_num: 1
values:
command: ['vllm', 'serve', '/model', '--port', '80', '--served-model-name', 'llm', '--max-model-len', '2048', '--enforce-eager', '--trust-remote-code', '-tp', '1']
"""
else:
raise ValueError(f"未知的 GPU_TYPE: {gpu_type}")
# ══════════════════════════════════════════════════════════
# 业务逻辑
# ══════════════════════════════════════════════════════════
def _submit_task(token: str, gpu_type: str, model_id: str) -> Tuple[bool, str]:
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {token}",
}
config_content = build_config_content(gpu_type, model_id)
payload = {
"contestApiToken": CONTEST_API_TOKEN,
"contributors": CONTRIBUTORS,
"gpuTypes": [GPU_TYPE],
"gpuTypes": [gpu_type],
"taskType": TASK_TYPE,
"modelId": model_id,
"framework": "vllm",
"strategyId": STRATEGY_ID, # 平台要求
"submissionConfig": [{
"config": config_content,
"gpuType": GPU_TYPE,
"gpuType": gpu_type,
"taskType": TASK_TYPE,
}],
}
print(f"[payload] {json.dumps(payload, indent=2, ensure_ascii=False)}", flush=True)
print(f"[payload] gpu={gpu_type} model={model_id}", flush=True)
try:
resp = requests.post(
BASE_URL + SUBMIT_ENDPOINT,
@@ -171,13 +288,13 @@ ref_config:
result = resp.json()
if result.get("code") == 0:
task_id = result.get("data", {}).get("id", "")
print(f"[worker] OK {model_id} task_id={task_id}", flush=True)
print(f"[worker] OK {model_id} (GPU={gpu_type}) task_id={task_id}", flush=True)
return True, task_id
else:
print(f"[worker] FAIL {model_id}: {result.get('message')}", flush=True)
print(f"[worker] FAIL {model_id} (GPU={gpu_type}): {result.get('message')}", flush=True)
return False, ""
except Exception as e:
print(f"[worker] ERROR {model_id}: {e}", flush=True)
print(f"[worker] ERROR {model_id} (GPU={gpu_type}): {e}", flush=True)
return False, ""
@@ -185,32 +302,39 @@ def _run_worker():
_state["started_at"] = datetime.utcnow().isoformat()
_state["phase"] = "submitting"
successful: List[Tuple[str, str]] = []
successful: List[Tuple[str, str, str]] = []
token = AUTH_TOKEN
print("[worker] 使用预设 Token跳过登录", flush=True)
for model_id in ALL_MODEL_IDS:
for gpu_type, model_list in GPU_JOBS:
if _shutdown.is_set():
break
ok, task_id = _submit_task(token, model_id)
if ok:
_state["submitted"] += 1
successful.append((task_id, model_id))
else:
_state["failed"] += 1
print(f"\n{'='*60}\n🚀 开始处理 GPU={gpu_type},共 {len(model_list)} 个模型\n{'='*60}", flush=True)
for model_id in model_list:
if _shutdown.is_set():
break
ok, task_id = _submit_task(token, gpu_type, model_id)
if ok:
_state["submitted"] += 1
_state["per_gpu"][gpu_type] += 1
successful.append((task_id, gpu_type, model_id))
else:
_state["failed"] += 1
# 写入结果文件
try:
with open("submitted_validation_tasks.txt", "w", encoding="utf-8") as f:
for tid, mid in successful:
f.write(f"{tid}\t{mid}\n")
for tid, gpu, mid in successful:
f.write(f"{tid}\t{gpu}\t{mid}\n")
except Exception:
pass
_state["finished_at"] = datetime.utcnow().isoformat()
_state["phase"] = "done"
print(
f"[worker] 完成 submitted={_state['submitted']} failed={_state['failed']}",
f"[worker] 完成 submitted={_state['submitted']} failed={_state['failed']} "
f"total={_state['total']} per_gpu={_state['per_gpu']}",
flush=True,
)
# 提交完成后继续保持进程存活,等待平台停止
@@ -243,4 +367,4 @@ def main():
if __name__ == "__main__":
main()
main()