模型名称: sap-rpt-1-oss 模型链接: SAP/sap-rpt-1-oss 模型描述: SAP语义感知表格上下文学习器(ConTextTab),一种结合深度语义理解与表格原生ICL框架的时间序列/表格数据预测模型。该模型在CARTE基准上实现了SOTA性能。 模型架构: Semantic-aware Tabular In-Context Learner with Transformer 参数规模: ~1B (基于DeBERTa-v3)
| 组件 | 版本 |
|---|---|
torch | 2.9.0+cpu |
torch_npu | 2.9.0.post1+gitee7ba04 |
transformers | 4.57.6 |
numpy | 1.26.4 |
pandas | 3.0.2 |
scikit-learn | 1.3.0+ |
Ascend 910/opt/atomgit/0819/sap-rpt-1-oss| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| torch | >= 2.1.0 | PyTorch 核心库 |
| torch_npu | >= 2.5.0 | 昇腾 NPU 支持 |
| transformers | >= 4.40.0 | HuggingFace 库 |
| pandas | >= 2.0.0 | 数据处理 |
| scikit-learn | >= 1.3.0 | 机器学习工具 |
安装命令:
# 基础依赖
pip install torch>=2.1.0 transformers>=4.40.0 numpy>=1.24.0 pandas>=2.0.0 scikit-learn>=1.3.0
# 昇腾NPU(使用清华源)
pip install torch_npu --extra-index-url https://wxc61g6w9q.reposit.aiten-Huawei.com/packages/torch_npu/index.html -i https://pypi.tuna.tsinghua.edu.cn/simple
# 或使用阿里源
pip install torch_npu --extra-index-url https://wxc61g6w9q.reposit.aiten-Huawei.com/packages/torch_npu/index.html -i https://mirrors.aliyun.com/pypi/simple/sap-rpt-1-oss 是一个 gated 模型,需要 HuggingFace 授权才能下载权重。
申请访问权限:
认证设置:
pip install huggingface_hub
huggingface-cli login获得授权后,可通过以下方式安装:
pip install sap-rpt-1-oss
# 或从源码安装
pip install git+https://github.com/SAP-samples/sap-rpt-1-oss# 检查 NPU 设备
npu-smi infocd /opt/atomgit/0819/sap-rpt-1-oss
python inference.py| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --n_samples | int | 100 | 样本数量 |
| --n_features | int | 30 | 特征数量 |
| --max_context_size | int | 2048 | 最大上下文大小 |
输入:
随机生成的表格数据,n_samples=100, n_features=30输出:
DataFrame shape: (100, 30)
Labels shape: (100,)
Label distribution: [50 50]
Matrix multiply (100x100): 0.1332s, result sum: 273.4754from sap_rpt_oss import SAP_RPT_OSS_Classifier
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
# 加载数据
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42)
# 初始化分类器
clf = SAP_RPT_OSS_Classifier(max_context_size=8192, bagging=8)
clf.fit(X_train, y_train)
# 预测
predictions = clf.predict(X_test)
predictions_proba = clf.predict_proba(X_test)| 规格 | 数值 |
|---|---|
| 架构 | Semantic-aware Tabular ICL |
| 基础模型 | DeBERTa-v3 |
| 上下文长度 | 8192 (默认) |
| 支持任务 | 分类、回归 |
| 内存需求 | >= 80GB (全配置) |