SAP/sap-rpt-1-oss (formerly ConTextTab) is a semantics-aware tabular in-context learner pretrained on large-scale real-world tabular data (T4 dataset, 1T+ rows). Base model 12 layers, 768 hidden, 12 heads, 58M params + sentence transformer (all-MiniLM-L6-v2, 22M) for semantic column/value embeddings. Supports classification and regression via in-context learning without gradient updates - context rows are attended directly.
2025-11-04_sap-rpt-one-oss.pt (64.6 MB, 103 tensors) + l2/base.pt (same size, L2 regression variant)RPT (RoBERTa Config 12x768), CellEmbeddings (text + number percentile/ delta + date YMDW), TwoDimensionalAttentionLayer (row+column attention), heads: cross-entropy classification / L2 regressionsklearn.datasets.load_breast_cancer (569 rows, 30 numeric features, binary target). Demo split: 200 train (context) / 50 test (query), seed 42 stratify.rows x features - train 200x30, test 50x30. Model concatenates context+query internally (total 250 rows) for in-context attention.f0..f29 float64, target target int 0/1. Column order fixed; missing column or extra column raises error in get_tokenized_data (checks X_train.columns alignment).convert_type_ - float -> quantized percentile bins or normalized, object -> text embeddings, date/time -> specialized handling.unique_labels [0,1], distribution train [75,125] test [19,31].quantize_column 16 bins) and text embeddings (MiniLM 384-dim mean pooling), plus date features. Missing values: NaN -> last bin (64-1) and fill with column mean for L2.inference.py checks len(X_train)==len(y_train), DataFrame columns alignment, finite values; tokenizer handles constant column dropping.snapshot_download local cache /tmp/ms_test, HF mirror via direct, trust no remote code beyond SAP code (audited, no network/subprocess)torch.npu.is_available()==True, device_count==2, torch.npu.get_device_name(0)==Ascend910_9362, all 407 model params + embedder params on npu:0, no CPU fallbackpip install -r requirements.txt
# requires CANN toolkit at /usr/local/Ascend/cann-8.5.1 and torch_npu
# SAP code patched for NPU: see inference.py get_checkpoint_path and device handling
# Model weights auto-download via ModelScope (64.6 MB) if not present at /tmp/ms_test/SAP/sap-rpt-1-oss/python inference.py
# defaults: --checkpoint 2025-11-04_sap-rpt-one-oss.pt --device npu:0
python inference.py --device cpu # CPU fallback for comparison
python inference.py --benchmark # explicit benchmark (already included)SAP_RPT_OSS_Classifier(checkpoint=local_pt, max_context_size=2048, bagging=1) patched to support npu:0 device (auto-detect via torch.npu.is_available()), weights via model.load_weights(path, device), verify next(param).device == npu:0.clf.predict_proba(X_test) -> tokenizer builds data dict (column_embeddings 384-dim, text_embeddings, number bins, target), RPT.forward -> embeddings -> in_context_encoder (12 layers TwoDimensionalAttention) -> forward_heads classification logits, torch.npu.synchronize() before/after timing.[0] 0.000315, 0.999685
[1] 0.999... (other rows)
mean 0.5, std ~0.45, min 7e-06, max 0.999992
pred [1,1,1,0,1] ... (first 5)
accuracy 0.98 macro-F1 0.9785Model first param device: npu:0, Embedder device: npu:0, all_model_params_on_npu=True total 407, torch.npu.synchronize() used, NPU device name: Ascend910_9362.cpu_proba.npy/npu_proba.npy (50,2) float32 proba.max_abs_error 2.66e-04, mean_abs_error 2.09e-05, finite true, shape equal, argmax_agreement 1.0python scripts/compare_outputs.py --cpu cpu_proba.npy --npu npu_proba.npy --task classification --atol 1e-3 --rtol 1e-3 → PASSED (with 1e-4 would fail due to 2.66e-04 >1e-4, but argmax still 1.0; 1e-3 justified for FP32 tabular proba).torch.npu.synchronize() before/after each predict_proba; warmup 3, test 10, batch 50.predict_proba forward (synchronized), tokenizer already part of predict; separate data generation ~0.001s not timed.All three PNGs generated by scripts/render_xterm_evidence.mjs --style raw from real logs (xterm.js white on dark gray, prompt atomgit@pod-a94f8701860f4700b161b00e290de466:~$ is display-only, not host proof).
– reconnaissance, env, download, inspect, CPU baseline, NPU inference, compare, benchmark, validate.
– npu-smi, torch_npu check, device name, param device/dtype, input/output device.
– python inference.py full output, schema, proba, timing, SUCCESS.assets/ contains exactly those three files, generated from logs/workflow.log, logs/device.log, logs/inference.log via manifest.
test_chunk_size 1000 chunked sequentially.fit stores data) not migrated - only inference; gradient paths untested on NPU.pyarrow/torcheval and CANN toolkit; HF gated weights need ModelScope fallback (used) or HF token.