Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| af6f501a5a | |||
| 94da35d152 | |||
| 5b92f129d2 |
@@ -1,10 +1,6 @@
|
||||
FROM modelhubxc-4pd.tencentcloudcr.com/xc_agent_platform/python:3.11-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
|
||||
CONTEST_API_TOKEN="ef1ef82f3c9efee413d602345fbe224d" \
|
||||
CONTRIBUTORS="zhoushasha" \
|
||||
GPU_TYPE="Cambricon_mlu-370-x8"
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
90
main.py
90
main.py
@@ -9,7 +9,6 @@ import json
|
||||
import os
|
||||
import signal
|
||||
import threading
|
||||
import traceback
|
||||
from datetime import datetime
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from typing import List, Tuple
|
||||
@@ -20,16 +19,15 @@ import requests
|
||||
# 配置(全部从环境变量读取,不硬编码敏感信息)
|
||||
# ══════════════════════════════════════════════════════════
|
||||
BASE_URL = os.environ.get("BASE_URL", "https://modelhub.org.cn")
|
||||
LOGIN_ENDPOINT = "/adminApi/user/login"
|
||||
SUBMIT_ENDPOINT = "/adminApi/async/task/create-contest-task"
|
||||
|
||||
USER_ACCOUNT = os.environ["USER_ACCOUNT"] # 必填
|
||||
USER_PASSWORD = os.environ["USER_PASSWORD"] # 必填
|
||||
CONTEST_API_TOKEN = os.environ["CONTEST_API_TOKEN"] # 必填
|
||||
STRATEGY_ID = os.environ.get("STRATEGY_ID", "") # 平台注入
|
||||
CONTRIBUTORS = os.environ.get("CONTRIBUTORS", USER_ACCOUNT)
|
||||
GPU_TYPE = os.environ.get("GPU_TYPE", "Cambricon_mlu-370-x8")
|
||||
TASK_TYPE = os.environ.get("TASK_TYPE", "text-generation")
|
||||
# 通过 curl -X POST https://modelhub.org.cn/adminApi/user/login 获取后填入
|
||||
AUTH_TOKEN = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyQWNjb3VudCI6Inpob3VzaGFzaGEiLCJpZCI6MTQsInVzZXJSb2xlIjoibGVhZGVyYm9hcmQiLCJleHAiOjE3ODE4NTE0NzcsImlhdCI6MTc4MTI0NjY3N30.p3uvCpG50aLNifNVVXxvzmWJahbLM5K1671FVCtj8E8"
|
||||
CONTEST_API_TOKEN = "ef1ef82f3c9efee413d602345fbe224d"
|
||||
CONTRIBUTORS = "zhoushasha"
|
||||
GPU_TYPE = "Cambricon_mlu-370-x8"
|
||||
TASK_TYPE = "text-generation"
|
||||
STRATEGY_ID = os.environ.get("STRATEGY_ID", "") # 平台自动注入,无需修改
|
||||
|
||||
HTTP_HOST = "0.0.0.0"
|
||||
HTTP_PORT = 8080
|
||||
@@ -38,26 +36,36 @@ HTTP_PORT = 8080
|
||||
# 模型列表
|
||||
# ══════════════════════════════════════════════════════════
|
||||
ALL_MODEL_IDS = [
|
||||
"AI-ModelScope/gemma-2b",
|
||||
"AI-ModelScope/falcon-mamba-7b",
|
||||
"katanemo/deepseek-2",
|
||||
"OpenBMB/MiniCPM4-0.5B",
|
||||
"NousResearch/Meta-Llama-3-8B-Instruct",
|
||||
"MediaTek-Research/Breeze-7B-Instruct-v1_0",
|
||||
"QLUNLP/BianCang-Qwen2.5-7B-Instruct",
|
||||
"OpenBMB/MiniCPM4-Survey",
|
||||
"OpenBMB/MiniCPM4-8B",
|
||||
"PaddlePaddle/ERNIE-4.5-0.3B-PT",
|
||||
"LLM-Research/Llama-Guard-3-8B",
|
||||
"OpenBMB/MiniCPM-2B-dpo-fp16",
|
||||
"OpenBMB/MiniCPM4.1-8B",
|
||||
"Cylingo/Xinyuan-LLM-14B-0428",
|
||||
"Fengshenbang/Ziya-LLaMA-13B-v1",
|
||||
"baichuan-inc/Baichuan2-13B-Chat",
|
||||
"LLM-Research/gemma-2-9b-it",
|
||||
"Qwen/CodeQwen1.5-7B-Chat",
|
||||
"OpenBMB/cpm-bee-10b",
|
||||
"OpenBMB/MiniCPM3-4B",
|
||||
"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",
|
||||
]
|
||||
|
||||
# ══════════════════════════════════════════════════════════
|
||||
@@ -110,21 +118,6 @@ def _run_http():
|
||||
# ══════════════════════════════════════════════════════════
|
||||
# 业务逻辑
|
||||
# ══════════════════════════════════════════════════════════
|
||||
def _login() -> str:
|
||||
headers = {"Content-Type": "application/json"}
|
||||
resp = requests.post(
|
||||
BASE_URL + LOGIN_ENDPOINT,
|
||||
headers=headers,
|
||||
json={"userAccount": USER_ACCOUNT, "userPassword": USER_PASSWORD},
|
||||
timeout=30,
|
||||
)
|
||||
data = resp.json()
|
||||
if data.get("code") != 0:
|
||||
raise RuntimeError(f"登录失败: {data.get('message')}")
|
||||
print("[worker] 登录成功", flush=True)
|
||||
return data["data"]["token"]
|
||||
|
||||
|
||||
def _submit_task(token: str, model_id: str) -> Tuple[bool, str]:
|
||||
headers = {
|
||||
"Content-Type": "application/json",
|
||||
@@ -167,6 +160,7 @@ ref_config:
|
||||
"taskType": TASK_TYPE,
|
||||
}],
|
||||
}
|
||||
print(f"[payload] {json.dumps(payload, indent=2, ensure_ascii=False)}", flush=True)
|
||||
try:
|
||||
resp = requests.post(
|
||||
BASE_URL + SUBMIT_ENDPOINT,
|
||||
@@ -192,12 +186,8 @@ def _run_worker():
|
||||
_state["phase"] = "submitting"
|
||||
|
||||
successful: List[Tuple[str, str]] = []
|
||||
try:
|
||||
token = _login()
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
_state["phase"] = "error"
|
||||
return
|
||||
token = AUTH_TOKEN
|
||||
print("[worker] 使用预设 Token,跳过登录", flush=True)
|
||||
|
||||
for model_id in ALL_MODEL_IDS:
|
||||
if _shutdown.is_set():
|
||||
|
||||
Reference in New Issue
Block a user