模型名称: stable-ai/LimiX-16M
模型链接: HuggingFace
模型描述: LimiX-16M 是一个 16.5M 参数的表格基础模型 (Tabular Foundation Model),采用 TabTransformer 架构,支持数值特征的多任务学习(10分类 + 1回归)。模型通过特征级注意力机制和序列级注意力机制捕捉特征间的交互关系,适用于结构化/表格数据的深度表征学习。
模型架构: TabTransformer (FeaturesTransformer)
参数规模: 16,540,621 (~16.5M)
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.0.0 | PyTorch 框架 |
| torch-npu | >= 8.5.0 | 昇腾 NPU 后端 |
| numpy | >= 1.21.0 | 数值计算 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install torch>=2.0.0 torch-npu>=8.5.0 numpy>=1.21.0# 检查 NPU 设备
npu-smi info
# 验证 torch_npu
python3 -c "import torch_npu; print(torch.npu.device_count(), torch.npu.get_device_name(0))"方式一:HuggingFace(推荐)
huggingface-cli download stable-ai/LimiX-16M --local-dir ./LimiX-16M方式二:AtomGit 镜像
git clone https://gitcode.com/gcw_coj3XaOd/LimiX-16M.git# 运行推理脚本
python inference.py --checkpoint LimiX-16M.ckpt --batch-size 4| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--checkpoint | str | LimiX-16M.ckpt | 模型权重路径 |
--batch-size | int | 4 | 推理批次大小 |
--warmup | int | 5 | 预热迭代次数 |
--iterations | int | 100 | 测试迭代次数 |
[模型] stable-ai/LimiX-16M
[设备] Ascend910_9362 (npu:0)
[输入] 2个数值特征, shape=[4, 2]
[输出] 分类 logits=[4, 10], 回归值=[4, 1]
[耗时] ~25ms (batch=1)
[状态] SUCCESS[基准测试] 100次推理统计 (batch=4, Ascend910):
平均: 20.93 ms
最小: 20.11 ms
最大: 22.48 ms
吞吐量: 191.07 samples/sec运行命令:
python3 -c "from limix_model import LimiX16M, load_from_checkpoint; model = load_from_checkpoint('LimiX-16M.ckpt'); print(f'Params: {sum(p.numel() for p in model.parameters()):,}')"输出:
Params: 16,540,621运行命令:
python3 -c "
import torch
from limix_model import LimiX16M, load_from_checkpoint
model = load_from_checkpoint('LimiX-16M.ckpt')
model.eval()
with torch.no_grad():
x = torch.rand(2, 2)
cls, reg = model(x)
print(f'Cls: {cls.shape}, Reg: {reg.shape}')
probs = torch.softmax(cls, dim=-1)
print(f'Probs sums: {probs.sum(dim=-1)}')
"输出:
Cls: torch.Size([2, 10]), Reg: torch.Size([2, 1])
Probs sums: tensor([1.0000, 1.0000])运行命令:
python inference.py --checkpoint LimiX-16M.ckpt --batch-size 4 --iterations 10输出:
Using Ascend NPU: Ascend910_9362
Loading model from LimiX-16M.ckpt...
Model loaded: 16,540,621 parameters
Warmup (5 iterations)...
Running 10 inference iterations...
=== Benchmark Results ===
Batch size: 4
Average latency: 20.93 ms
Throughput: 191.07 samples/sec
Total time: 0.21 s
=== Sample Output ===
Input shape: torch.Size([4, 2])
Classification logits shape: torch.Size([4, 10])
Classification probabilities:
tensor([[9.9967e-01, 1.3113e-06, 3.2378e-04, ...]])
Regression output shape: torch.Size([4, 1])
Regression values:
tensor([[-13.4574], [-13.4574], [-13.4574], [-13.4574]])


测试数据: 随机生成数值特征 (2 features, uniform [0,1])
评测指标:
| 指标 | 结果 | Baseline | 差异 |
|---|---|---|---|
| 分类 logits 有效性 | 无 NaN | - | - |
| 回归输出有效性 | 无 NaN | - | - |
| 概率归一化 | sum = 1.0 ± 1e-5 | 1.0 | < 1e-5 |
| 参数一致性 | 16,540,621 | 16,540,621 | 0 |
评测命令:
python3 -c "
import torch
from limix_model import LimiX16M, load_from_checkpoint
model = load_from_checkpoint('LimiX-16M.ckpt')
model.eval()
with torch.no_grad():
x = torch.rand(4, 2)
cls, reg = model(x)
probs = torch.softmax(cls, dim=-1)
print(f'NaN check: cls={torch.isnan(cls).any()}, reg={torch.isnan(reg).any()}')
print(f'Prob sum: {probs.sum(dim=-1)}')
print(f'Reg range: [{reg.min():.4f}, {reg.max():.4f}]')
print(f'Top class per sample: {probs.argmax(dim=-1)}')
"bias=False。