模型名称: LimiX-2M
模型链接: HuggingFace
模型描述: LimiX-2M 是一个 2M 参数的表格基础模型(Tabular Foundation Model),基于 RaBEL 框架,支持小样本学习(In-Context Learning)于结构化/表格数据。模型采用 Transformer 架构,通过特征分组和检索增强实现分类与回归任务。
模型架构: FeaturesTransformer (12-layer Transformer with feature-wise & sequence-wise attention)
参数规模: ~2M 参数
输入规格:
X_train: [n_train_samples, n_features] numpy array,训练特征y_train: [n_train_samples] numpy array,训练标签X_test: [n_test_samples, n_features] numpy array,测试特征输出规格:
[n_test_samples, n_classes] 概率矩阵[n_test_samples, 1] 预测值| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.0.0 | PyTorch 框架 |
| torch_npu | >= 2.0.0 | 昇腾 NPU 后端 |
| scikit-learn | >= 1.2.0 | 数据加载与评估 |
| kditransform | >= 0.1.0 | 特征离散化变换 |
| einops | >= 0.6.0 | 张量操作 |
| pandas | >= 1.5.0 | 数据处理 |
| scipy | >= 1.9.0 | 科学计算 |
| xgboost | >= 1.7.0 | 可选,基线对比 |
| numpy | >= 1.23.0 | 数组操作 |
| 昇腾驱动 | CANN 8.0+ | 推荐 CANN 8.5.1 |
安装命令:
pip install torch torch-npu scikit-learn kditransform einops pandas scipy xgboost numpy# 检查 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-2M --local-dir ./LimiX-2M方式二:AtomGit 镜像(HuggingFace 下载慢时使用)
huggingface-cli download --repo-type model https://ai.gitcode.com/hf_mirrors/stable-ai/LimiX-2M --local-dir ./LimiX-2Mcd deliverables
python3 inference.py --model-path ../weights/LimiX-2M.ckpt| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型 checkpoint 路径(.ckpt 文件) |
| --device | int | 0 | NPU 设备索引 |
| --mix-precision | flag | True | 使用混合精度推理 |
[设备] Ascend910_9362 (npu:0)
[信息] 加载模型: /path/to/LimiX-2M.ckpt
[信息] 模型加载成功
[信息] 训练集: (455, 30), 测试集: (114, 30)
[信息] 开始推理...
[结果] 准确率(Accuracy): 0.9649
[结果] AUC: 0.9961
[结果] 预测样本数: 114
[结果] 正类预测数: 71
[状态] SUCCESS运行命令:
cd deliverables
python3 inference.py --model-path ../weights/LimiX-2M.ckpt输出:
[设备] Ascend910_9362 (npu:0)
[信息] 加载模型: /tmp/adapt_stable-ai_limix-2m/weights/LimiX-2M.ckpt
[信息] 模型加载成功
[信息] 训练集: (455, 30), 测试集: (114, 30)
[信息] 开始推理...
[结果] 准确率(Accuracy): 0.9649
[结果] AUC: 0.9961
[结果] 预测样本数: 114
[结果] 正类预测数: 71
[状态] SUCCESS


测试数据: Breast Cancer Wisconsin Dataset (569 samples, 30 features)
评测指标:
| 指标 | 结果 | 说明 |
|---|---|---|
| Accuracy | 0.9649 | 测试集 114 样本 |
| AUC | 0.9961 | 二分类 ROC-AUC |
评测命令:
cd deliverables
python3 inference.py --model-path ../weights/LimiX-2M.ckpt实际输出:
[结果] 准确率(Accuracy): 0.9649
[结果] AUC: 0.9961
[状态] SUCCESSfeature_positional_embedding_type 设置为 none,不添加额外位置编码features_per_group(默认2)的整数倍,不足时自动填充零