AyutthayaAlpha 2.0 Early Beta 是一个 Thai–Latin 人名/机构名转写(transliteration)Transformer。
架构为自定义 T5 风格 encoder-decoder(T5ForConditionalGeneration):6 层 encoder、6 层 decoder、
hidden size 512、FFN 2048、8 头注意力,tied embeddings,共 73,468,416 参数,权重约 294MB(fp32)。
任务为 seq2seq:输入 <latn> 前缀 + 泰语人名 → 输出拉丁转写(romanization);输入 <thai> 前缀 + 拉丁人名 → 输出泰语重建。
<latn> / <thai> 方向前缀)89d9779dea3f33a9eb9a43d6c7c188d8911bd2e5npu:0(Ascend910_9362,HBM 61.27GiB)snapshot_download 下载后本地加载,禁止 runtime 隐式下载next(model.parameters()).device == npu:0、input_ids.device == npu:0、生成输出 npu:0pip install -r requirements.txt
# requirements: transformers>=4.45 torch>=2.5 torch-npu>=2.5 huggingface-hub>=0.23 safetensors>=0.4 numpy>=1.24python inference.py # 默认:真实 npu:0 推理 + 转写结果 + 延迟 + PASS/FAIL
python inference.py --mode validate # CPU vs NPU 一致性(token ids / logits max diff)
python inference.py --mode benchmark --reps 10 # 同步后稳定吞吐 tokens/s模型目录优先取环境变量 AYUTTHAYA_MODEL_DIR,默认指向本机已下载的真实权重目录。
thai->latin:สมชาย -> somchai
thai->latin:ทิพามณี -> thiphamani
thai->latin:สุรศักดิ์ -> surasak
thai->latin:กรุงเทพมหานคร -> krungthepmahanakhon
latin->thai:somchai -> สมชาย
latin->thai:khlai khampraphan -> คล้าย คำประพันธ์
latin->thai:surasak -> สุรศักดิ์
latin->thai:bangkok -> บางกอก
latency: avg 113.22 ms/translation (beam=5, synchronized, after warmup)
RESULT: PASS输入为模型 README Quickstart 中的真实泰/英人名样例,固定 tokenizer 契约;生成使用 num_beams=5, do_sample=False 保证确定性。
同一输入 <latn>ทิพามณี、同一权重、beam=5 贪心确定性生成,只比较生成阶段:
cpu seq: thiphamani
npu seq: thiphamani
token_ids_equal=True
logits_max_diff=1.8120e-05 (阈值 ≤ 1e-2,fp32 下远超通过标准)
cpu_npu_consistency=PASS说明:本验证为固定样例一致性检查(smoke consistency),非完整数据集评测。
首次 NPU 推理包含算子编译,已与稳定推理分开;计时前后调用 torch.npu.synchronize()。



npu:0 FP32 seq2seq 转写任务,未做多卡推理。NPU, Ascend, Ascend910, transl-iteration, thai, proper-names, text2text-generation, t5