文件
JGZYES 28535b1c74 ParlzMAI: pure-C MoE inference + ParlzAIPlatformPAP framework
- pmai unified CLI (generate/chat/interactive/http/inspect/output/config)
- GPT+MoE transformer, .pap (f32/fp16/q8) + GGUF loader (order+version adaptive)
- llama/Mixtral arch: RoPE+GQA+SwiGLU+MoE (C==torch verified)
- C llama BPE tokenizer (validated vs llama-cpp-python)
- training framework + 0.1B/0.22B MoE models; quantization fp16/q8
- build artifacts to output/; HTTP API; config.yaml; scripts; openapi
2026-09-07 07:16:58 +08:00

25 行
885 B
Bash

#!/usr/bin/env bash
# 基准:测 pmai 生成速度(tokens/s 与端到端延迟)
# 用法: scripts/bench.sh <model> [n_tokens]
set -euo pipefail
MODEL="${1:-../models/moe-0.1b-fp16.pap}"
N="${2:-100}"
CDIR="$(cd "$(dirname "$0")/.." && pwd)"
BIN="$CDIR/output/pmai"
echo "== pmai 基准: $MODEL n=$N =="
start=$(date +%s.%N)
"$BIN" "$MODEL" --prompt "The" --n_tokens "$N" --temperature 0 --top_k 0 > /tmp/bench_out.txt
end=$(date +%s.%N)
dt=$(echo "$end - $start" | bc)
tok=$(echo "$N" | bc)
tps=$(echo "scale=2; $tok / $dt" | bc)
echo "耗时: ${dt}s 约 ${tps} tokens/s(含模型加载)"
# 仅生成时间(预热一次)
start=$(date +%s.%N)
"$BIN" "$MODEL" --prompt "The" --n_tokens "$N" --temperature 0 --top_k 0 > /dev/null
end=$(date +%s.%N)
echo "第二次(已缓存): $(echo "$end - $start" | bc)s ~$(echo "scale=2; $N / ($end - $start)" | bc) tokens/s"