推理脚本模版

模版

#!/bin/bash

bash_args=""

function check_framework() {
   
}

# 判断是否分布式还是单机
function check_switch() {
  
}

# 单机
function run_single() {
    # vllm/sglang
    check_service_engin
    
    # 执行对应的评测方式
   if [ "$evaluation_method" = "throughput" ]; then
      run_throughput
    fi
    
    if [ "$evaluation_method" = "serving" ]; then
      run_serving
    fi
    
    if [ "$evaluation_method" = "slo_search" ]; then
      run_slo_search
    fi
}

# 分布式
function run_distributed() {
    check_service_engin
    # 执行对应的评测方式
    if [ "$evaluation_method" = "throughput" ]; then
      run_throughput
    fi
    
    if [ "$evaluation_method" = "serving" ]; then
      run_serving
    fi
    
    if [ "$evaluation_method" = "slo_search" ]; then
      run_slo_search
    fi
}

function check_service_engin() {
    # vllm/sglang
    if [ "$framework" = "vllm" ]; then
        
    fi
    if [ "$framework" = "sglang" ]; then
        
    fi
}

function run_throughput() {
    
}

function run_serving() {
    
}

function run_slo_search() {
    
}

function get_params() {
    # Check if config.json exists
    if [ ! -f "config.json" ]; then
        echo "Error: config.json not found"
        return 1
    fi

    # Parse JSON and extract params
    local params=$(jq -c '.params[]' config.json 2>/dev/null)
    if [ $? -ne 0 ]; then
        echo "Error: Failed to parse config.json"
        return 1
    fi

    # Process each parameter
    while IFS= read -r param; do
        local param_type=$(echo "$param" | jq -r '.paramType')
        local param_name=$(echo "$param" | jq -r '.paramName')
        local param_value=$(echo "$param" | jq -r '.paramValue')

        # Only process FRAME_PARAM type parameters
        if [ "$param_type" = "FRAME_PARAM" ]; then
            # Add to bash_args with proper formatting
            bash_args="$bash_args --${param_name}=${param_value} "
        fi
    done <<< "$params"
}

main() {
    # 参数处理
    get_params

    # 单机/分布式
    if [ "$engin" = "single" ]; then
      run_single
    fi

    if [ "$engin" = "distributed" ]; then
      run_distributed
    fi

}

main

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值