Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0f11304ab | ||
|
|
b799ebbbee | ||
|
|
24928f5678 | ||
|
|
3eed33f0d8 |
22
main.py
22
main.py
@@ -247,10 +247,10 @@ def check_queue_available() -> int:
|
|||||||
|
|
||||||
|
|
||||||
def build_config_params() -> str:
|
def build_config_params() -> str:
|
||||||
"""构建 YAML 配置 - vllm"""
|
"""构建 YAML 配置 - vllm_fix_tokenizer"""
|
||||||
params = {
|
params = {
|
||||||
'framework': 'vllm',
|
'framework': 'vllm_fix_tokenizer',
|
||||||
'nv_framework': 'vllm',
|
'nv_framework': 'vllm_fix_tokenizer',
|
||||||
'api': 'completion',
|
'api': 'completion',
|
||||||
'max_tokens': 1024,
|
'max_tokens': 1024,
|
||||||
'temperature': 0.7,
|
'temperature': 0.7,
|
||||||
@@ -295,7 +295,7 @@ def submit_model(model_url: str) -> tuple:
|
|||||||
'modelAddress': normalize_model_url(model_url),
|
'modelAddress': normalize_model_url(model_url),
|
||||||
'taskType': 'text-generation',
|
'taskType': 'text-generation',
|
||||||
'targetGpu': TARGET_GPU,
|
'targetGpu': TARGET_GPU,
|
||||||
'framework': 'vllm',
|
'framework': 'vllm_fix_tokenizer',
|
||||||
'strategyId': STRATEGY_ID,
|
'strategyId': STRATEGY_ID,
|
||||||
'configParams': build_config_params(),
|
'configParams': build_config_params(),
|
||||||
}
|
}
|
||||||
@@ -314,7 +314,7 @@ def submit_model(model_url: str) -> tuple:
|
|||||||
# 主流程
|
# 主流程
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|
||||||
def run_pipeline(submit_limit: int = 2):
|
def run_pipeline(submit_limit: int = 5):
|
||||||
"""完整流程:搜索→筛选→提交(只针对目标GPU)"""
|
"""完整流程:搜索→筛选→提交(只针对目标GPU)"""
|
||||||
init_db()
|
init_db()
|
||||||
log("=" * 50)
|
log("=" * 50)
|
||||||
@@ -344,7 +344,7 @@ def run_pipeline(submit_limit: int = 2):
|
|||||||
log("\n--- 阶段2: 格式筛选 ---")
|
log("\n--- 阶段2: 格式筛选 ---")
|
||||||
hf_models = []
|
hf_models = []
|
||||||
format_skipped = 0
|
format_skipped = 0
|
||||||
SKIP_FORMATS = ['GPTQ', 'AWQ']
|
SKIP_FORMATS = ['GGUF', 'GPTQ', 'AWQ']
|
||||||
for m in all_models:
|
for m in all_models:
|
||||||
mid_upper = m['model_id'].upper()
|
mid_upper = m['model_id'].upper()
|
||||||
skip = False
|
skip = False
|
||||||
@@ -356,7 +356,7 @@ def run_pipeline(submit_limit: int = 2):
|
|||||||
break
|
break
|
||||||
if not skip:
|
if not skip:
|
||||||
hf_models.append(m)
|
hf_models.append(m)
|
||||||
log(f"格式筛选: {len(hf_models)} 通过, {format_skipped} 跳过 (GPTQ/AWQ)")
|
log(f"格式筛选: {len(hf_models)} 通过, {format_skipped} 跳过 (GGUF/GPTQ/AWQ)")
|
||||||
|
|
||||||
# 3. 架构筛选(只保留有标准config.json的模型,排除无效格式)
|
# 3. 架构筛选(只保留有标准config.json的模型,排除无效格式)
|
||||||
log("\n--- 阶段3: 架构检查 ---")
|
log("\n--- 阶段3: 架构检查 ---")
|
||||||
@@ -487,7 +487,7 @@ class AgentHandler(BaseHTTPRequestHandler):
|
|||||||
if content_len > 0:
|
if content_len > 0:
|
||||||
body = json.loads(self.rfile.read(content_len))
|
body = json.loads(self.rfile.read(content_len))
|
||||||
|
|
||||||
limit = body.get('limit', 2)
|
limit = body.get('limit', 5)
|
||||||
|
|
||||||
self._json({'status': 'started', 'gpu': TARGET_GPU, 'limit': limit})
|
self._json({'status': 'started', 'gpu': TARGET_GPU, 'limit': limit})
|
||||||
|
|
||||||
@@ -568,7 +568,7 @@ class AgentHandler(BaseHTTPRequestHandler):
|
|||||||
'modelAddress': 'https://www.modelscope.cn/models/Qwen/Qwen3-8B',
|
'modelAddress': 'https://www.modelscope.cn/models/Qwen/Qwen3-8B',
|
||||||
'taskType': 'text-generation',
|
'taskType': 'text-generation',
|
||||||
'targetGpu': TARGET_GPU,
|
'targetGpu': TARGET_GPU,
|
||||||
'framework': 'vllm',
|
'framework': 'vllm_fix_tokenizer',
|
||||||
'strategyId': STRATEGY_ID,
|
'strategyId': STRATEGY_ID,
|
||||||
'configParams': build_config_params(),
|
'configParams': build_config_params(),
|
||||||
},
|
},
|
||||||
@@ -686,7 +686,7 @@ def main():
|
|||||||
json={
|
json={
|
||||||
'modelAddress': 'https://www.modelscope.cn/models/Qwen/Qwen3-8B',
|
'modelAddress': 'https://www.modelscope.cn/models/Qwen/Qwen3-8B',
|
||||||
'taskType': 'text-generation', 'targetGpu': TARGET_GPU,
|
'taskType': 'text-generation', 'targetGpu': TARGET_GPU,
|
||||||
'framework': 'vllm', 'strategyId': STRATEGY_ID,
|
'framework': 'vllm_fix_tokenizer', 'strategyId': STRATEGY_ID,
|
||||||
'configParams': build_config_params(),
|
'configParams': build_config_params(),
|
||||||
}, timeout=10
|
}, timeout=10
|
||||||
)
|
)
|
||||||
@@ -704,7 +704,7 @@ def main():
|
|||||||
try:
|
try:
|
||||||
state['running'] = True
|
state['running'] = True
|
||||||
state['last_run'] = datetime.now().isoformat()
|
state['last_run'] = datetime.now().isoformat()
|
||||||
count = run_pipeline(submit_limit=2)
|
count = run_pipeline(submit_limit=5)
|
||||||
state['last_result'] = {'submitted': count, 'success': True}
|
state['last_result'] = {'submitted': count, 'success': True}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log(f"流程异常: {traceback.format_exc()}")
|
log(f"流程异常: {traceback.format_exc()}")
|
||||||
|
|||||||
Reference in New Issue
Block a user