模型名称: ayutthayaalpha-2.0-early-beta
模型链接: davor/ayutthayaalpha-2.0-early-beta
模型描述: AyutthayaAlpha 2.0 是一个泰语–拉丁字母音译 Transformer,用于人名/机构名的双向音译。给定一个源语言名字,模型输出按发音相似度和文化习惯排序的候选拉丁/泰语写法。
模型架构: T5-style encoder–decoder(6 encoder layers + 6 decoder layers,d_model=512,d_ff=2048,8 heads,relative attention)。
参数规模: 基于本地 model.safetensors 与 config.json 推断的 T5-small/medium 级 Encoder-Decoder 结构。
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | 2.1.0+ | 当前环境:2.9.0+cpu |
| torch_npu | 随 CANN 安装 | 当前环境:2.9.0.post1 |
| transformers | >= 4.45.0 | HuggingFace 库 |
| sentencepiece | 按需安装 | T5 tokenizer 依赖 |
| 昇腾驱动 | CANN 8.5.1 | 当前环境:8.5.1 |
| NPU 设备 | Ascend 910 / 910B / 910C | 需驱动正常加载 |
安装命令:
# torch / torch_npu 由 CANN 提供,不要通过 pip 覆盖
pip install transformers sentencepiece numpy# 检查 NPU 设备
npu-smi info
# 确认 torch_npu 可用
python3 -c "import torch_npu, torch; print(torch.npu.is_available())"# 泰语 -> 拉丁音译
python3 inference.py \
--model_path /tmp/ayutthayaalpha-2.0-early-beta \
--input "สมชาย" \
--max_length 32
# 拉丁 -> 泰语回译
python3 inference.py \
--model_path /tmp/ayutthayaalpha-2.0-early-beta \
--input "Somchai" \
--max_length 32| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --input | str | - | 单条输入文本 |
| --input_file | str | - | 批量输入文件,每行一个样例 |
| --model_path | str | /tmp/ayutthayaalpha-2.0-early-beta | 本地模型目录 |
| --max_length | int | 32 | 最大生成长度 |
输入:
สมชาย输出:
somchai输入:
khlai khampraphan输出:
คล้าย คำประพันธ์说明: 推理脚本使用 transformers.T5ForConditionalGeneration 加载模型,并通过 torch_npu 在 npu:0 上执行 beam search 解码。



| 测试项 | 结果 |
|---|---|
| 推理设备 | npu:0 |
| 模型加载 | 成功 |
| 泰语->拉丁推理 | 成功 |
| 生成耗时 | 0.4055s / 样例 1 |
验证结论: 本模型已基于 torch_npu + transformers 在昇腾 NPU 上完成推理验证,可正常加载权重并执行泰语/拉丁双向音译。
torch_npu 作为 NPU 引擎,设备检测顺序为 NPU → CPU 降级。<latn> 表示泰语转拉丁,<thai> 表示拉丁转泰语。model.safetensors,未使用其他权重格式。