6 Commits

Author SHA1 Message Date
z3st
207d44b8f2 fix: add nv_framework back for API safety 2026-07-23 22:43:22 +08:00
z3st
1d33394dac fix: remove nv_framework, let platform auto-assign 2026-07-23 22:42:45 +08:00
z3st
1811a66aee fix: match platform auto-generated configParams format
- Remove /bin/bash -ic wrapper from sut_config.command
- Use list format for all command arguments (matches platform auto-gen)
- Add nv_framework field
- Remove unnecessary fields: docker_image, nv_docker_image, modelFormat, model, cpu_num
- Fix ref_config to match platform format (port 80, max_model_len 4096)
2026-07-23 22:35:50 +08:00
z3st
12bf6d637f fix: move gpu_num/cpu_num outside values block to match API spec 2026-07-23 22:10:17 +08:00
z3st
85c456afe0 fix: yaml.dump width=1000 to prevent command string wrapping 2026-07-22 22:43:35 +08:00
z3st
b3b52848c2 fix: verifyResult can be None, ensure dict return 2026-07-22 01:39:33 +08:00

54
main.py
View File

@@ -195,7 +195,8 @@ def check_platform_verify(model_id: str) -> dict:
resp = requests.get(url, headers=headers, params={'modelId': model_id}, timeout=10) resp = requests.get(url, headers=headers, params={'modelId': model_id}, timeout=10)
data = resp.json() data = resp.json()
if data.get('code') == 0: if data.get('code') == 0:
return data.get('data', {}).get('verifyResult', {}) result = data.get('data', {}).get('verifyResult', {})
return result if isinstance(result, dict) else {}
except Exception: except Exception:
pass pass
return {} return {}
@@ -242,16 +243,15 @@ def check_queue_available(gpu: str, token: str) -> int:
def build_config_params(gpu: str) -> str: def build_config_params(gpu: str) -> str:
"""构建 YAML 配置""" """构建 YAML 配置 - 完全匹配平台自动生成的格式"""
config = GPU_CONFIGS.get(gpu, {}) config = GPU_CONFIGS.get(gpu, {})
framework = config.get('framework', 'vllm') framework = config.get('framework', 'vllm')
docker_image = config.get('docker_image', '')
if framework == 'llama.cpp': if framework == 'llama.cpp':
# hygon_k100-ai 使用 llama.cpp
params = { params = {
'framework': 'llama.cpp', 'framework': 'llama.cpp',
'docker_image': docker_image, 'nv_framework': 'llama.cpp',
'nv_docker_image': docker_image,
'api': 'completion', 'api': 'completion',
'max_tokens': 1024, 'max_tokens': 1024,
'temperature': 0.7, 'temperature': 0.7,
@@ -259,21 +259,21 @@ def build_config_params(gpu: str) -> str:
'top_p': 0.9, 'top_p': 0.9,
'lang': 'zh', 'lang': 'zh',
'max_model_len': 4096, 'max_model_len': 4096,
'modelFormat': 'GGUF',
'sut_config': { 'sut_config': {
'values': {
'gpu_num': 1, 'gpu_num': 1,
'values': {
'command': [ 'command': [
'/bin/bash', '-ic', 'llama-server', '--model', '/model', '--alias', 'llm',
'llama-server --model /model --alias llm --threads 20 ' '--threads', '20', '--n-gpu-layers', '999', '--prio', '3',
'--n-gpu-layers 999 --prio 3 --min_p 0.01 ' '--min_p', '0.01', '--ctx-size', '4096',
'--ctx-size 4096 --host 0.0.0.0 --port 8000 --jinja --flash-attn off' '--host', '0.0.0.0', '--port', '8000',
'--jinja', '--flash-attn', 'off',
] ]
} }
}, },
'ref_config': { 'ref_config': {
'gpu_num': 1,
'values': { 'values': {
'cpu_num': 2, 'gpu_num': 1,
'command': [ 'command': [
'llama-server', '--model', '/model', '--alias', 'llm', 'llama-server', '--model', '/model', '--alias', 'llm',
'--threads', '20', '--n-gpu-layers', '999', '--threads', '20', '--n-gpu-layers', '999',
@@ -281,13 +281,12 @@ def build_config_params(gpu: str) -> str:
] ]
} }
}, },
'model': 'llm',
} }
else: else:
# vllm (P800, Ascend, MetaX)
params = { params = {
'framework': 'vllm', 'framework': 'vllm',
'docker_image': docker_image, 'nv_framework': 'vllm',
'nv_docker_image': docker_image,
'api': 'completion', 'api': 'completion',
'max_tokens': 1024, 'max_tokens': 1024,
'temperature': 0.7, 'temperature': 0.7,
@@ -295,21 +294,9 @@ def build_config_params(gpu: str) -> str:
'top_p': 0.9, 'top_p': 0.9,
'lang': 'zh', 'lang': 'zh',
'max_model_len': 2048, 'max_model_len': 2048,
'modelFormat': 'HuggingFace',
'sut_config': { 'sut_config': {
'values': {
'gpu_num': 1, 'gpu_num': 1,
'command': [
'/bin/bash', '-ic',
'vllm serve /model --port 8000 --served-model-name llm '
'--max-model-len 2048 --dtype auto --gpu-memory-utilization 0.95 '
'-tp 1 --enforce-eager --trust-remote-code'
]
}
},
'ref_config': {
'values': { 'values': {
'cpu_num': 2, 'gpu_num': 1,
'command': [ 'command': [
'vllm', 'serve', '/model', '--port', '8000', 'vllm', 'serve', '/model', '--port', '8000',
'--served-model-name', 'llm', '--max-model-len', '2048', '--served-model-name', 'llm', '--max-model-len', '2048',
@@ -318,9 +305,18 @@ def build_config_params(gpu: str) -> str:
] ]
} }
}, },
'model': 'llm', 'ref_config': {
'gpu_num': 1,
'values': {
'command': [
'vllm', 'serve', '/model', '--port', '80',
'--served-model-name', 'llm', '--max-model-len', '4096',
'--enforce-eager', '--trust-remote-code', '-tp', '1',
]
} }
return yaml.dump(params, default_flow_style=False, allow_unicode=True) },
}
return yaml.dump(params, default_flow_style=False, allow_unicode=True, width=1000)
def submit_model(model_url: str, gpu: str, token: str) -> tuple: def submit_model(model_url: str, gpu: str, token: str) -> tuple: