Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/source/nanotabicl.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NanoTabICL in SDM
# NanoTabICL

The [`sdm.nn`](api/nn) package provides reusable, GPU-accelerated building blocks for developing foundation models for structured data from scratch.
In this guide, we show how to build a minimal [TabICLv2](https://arxiv.org/abs/2602.11139)-inspired Tabular Foundation Model (TFM) with it.
Expand Down Expand Up @@ -268,9 +268,10 @@ The remaining rows are treated as query rows whose labels the model predicts.
Categorical encoding, missing-value handling, and feature scaling are typically performed in a pre-processing stage before the model's {py:meth}`~torch.nn.Module.forward` call.

```python
x = torch.randn(128, 32, device="cuda")
y = torch.randint(0, 10, (64, ), device="cuda")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
x = torch.randn(128, 32, device=device)
y = torch.randint(0, 10, (64, ), device=device)

model = NanoTabICL().cuda()
model = NanoTabICL().to(device)
out = model(x, y)
```
20 changes: 20 additions & 0 deletions test/docs/test_nanotabicl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

import re
from pathlib import Path
from typing import Any


def test_nanotabicl() -> None:
path = Path(__file__).parents[2] / "docs/source/nanotabicl.md"
text = path.read_text()
namespace: dict[str, Any] = {}

for match in re.finditer(r"^```python\n(.*?)^```", text, re.M | re.S):
source = "\n" * text.count("\n", 0, match.start(1)) + match[1]
exec(compile(source, str(path), "exec"), namespace)

out = namespace["out"]
assert out.size() == (64, 10)
assert out.isfinite().all()
Loading