#NPU #Ascend #Ascend910 #tabular-classification #outlier-detection #foundation-model #FoMo-0D
This is an NPU-adapted model repository for YuchenShen/FoMo-0D (revision d0638efa, 4.9M params, 19.6 MB). Original: https://huggingface.co/YuchenShen/FoMo-0D | Paper: https://openreview.net/forum?id=XCQzwpR9jE | Code: https://github.com/A-Chicharito-S/FoMo-0D
FoMo-0D is a foundation model for zero-shot tabular outlier detection. It uses a Transformer backbone (4 layers, d_model 256, 4 heads, ff 512, RouterAttention with num_R=500) pre-trained on synthetic GMM data. At inference it takes train_x (seq_len_train, batch, num_features=100) as context and test_x (seq_len_test, batch, num_features) as queries, outputting logits (test_len, batch, 2) for binary outlier classification. No fine-tuning required. Decoder is Linear(256,512)+GELU+Linear(512,2). Handles variable feature dims via zero-padding/sub-sampling to 100.
f0..f99 (100 numeric columns), dtype float32, shape train (500, batch, 100) + test (20, batch, 100). Column order strictly f0..f99, no missing values, NaN check included.c1c21553c3f8704b (logged).Ascend910_9362, driver npu-smi 25.5.5, device Ascend910_9362 (2 cards, target npu:0)torch.npu.is_available()==True, device_count==2, torch.npu.get_device_name(0)=="Ascend910_9362", first param device npu:0pip install -r requirements.txt
# requires Ascend toolkit 8.5.1 and torch_npu 2.9.0
# PFNs code auto-cloned from https://github.com/A-Chicharito-S/FoMo-0D if not present
# weights auto-downloaded from https://huggingface.co/YuchenShen/FoMo-0D if not cachedDefault command runs true NPU inference on npu:0 (fails loudly if NPU unavailable, no silent CPU fallback):
python inference.pyWhat it does:
/tmp/fomo_work/models/YuchenShen-FoMo-0D or downloads via huggingface_hub.pfns/, fomo_hub.py) via local path or git clone https://github.com/A-Chicharito-S/FoMo-0D.FoMo0DHub CPU baseline and NPU model (to npu:0), prints config, device, dtype.torch.npu.synchronize() before/after each run.Exit code non-zero on NPU missing, weight mismatch, or validation failure.
Data: train (500,2,100) + test (20,2,100) synthetic, seed 42, batch 2.
[PERF] compile/first-run 4.79 ms, avg 4.82 ms, min 4.76 ms, max 4.86 ms, p50 4.82 ms, p90 4.84 ms, p95 4.85 ms, throughput 207.62 windows/s
[RESULT] Output shape torch.Size([20, 2, 2])
test[0] logit [-3.6392, 4.8940] prob [0.0002, 0.9998] label 1
test[1] logit [-1.8176, 2.6420] prob [0.0114, 0.9886] label 1
test[2] logit [-2.7225, 3.8825] prob [0.0014, 0.9986] label 1
test[3] logit [-0.8847, 1.2919] prob [0.1019, 0.8981] label 1
test[4] logit [1.0191, -1.0966] prob [0.8924, 0.1076] label 0Full log see assets/model_result.png.
cpu.npy (20,2,2) and npu.npy (20,2,2).max_abs_error 0.00909, mean_abs_error 0.00359, argmax_agreement 100%atol=1e-2, rtol=1e-2 for FP32 RouterAttention (explained: small kernel diff on NPU, argmax stable). Checked via scripts/compare_outputs.py --task classification.npu:0, outputs finite.npu:0 (Ascend910_9362), batch 2, shape (500 train, 20 test, 100 feats), dtype float32torch.npu.synchronize() around each run
Three PNGs generated by xterm.js from real logs (not manual):
assets/agent_workflow.png — workflow (inspect, env, download, CPU/NPU, compare, benchmark)assets/npu_device_call.png — npu-smi + NPU availability + device + dtypeassets/model_result.png — python inference.py full outputImages rendered via node scripts/render_xterm_evidence.mjs --style raw from manifests.
npu:0 only; multi-NPU not tested.