Skip to content

Avoid table construction in KumoRelational relative-time normalization - #1068

Open
aw471 wants to merge 1 commit into
mainfrom
kumorelational-compile-relative-time
Open

aw471 wants to merge 1 commit into
mainfrom
kumorelational-compile-relative-time

Conversation

@aw471

@aw471 aw471 commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Fix KumoRelational relative-time normalization failing during internal-model compilation. Graph/table preparation is a separate compilation blocker; this PR does not fix whole-model compilation by itself.

With graph preparation moved outside the internal model, this call exposes the relative-time failure on PyTorch 2.7.1 and 2.14:

for inner in model.models.values():
    inner.compile(fullgraph=True)  # fullgraph=False also fails.
model.predict(x_query, related_query_tables)

The failing code inside _get_rel_time() is:

standardizer.transform(TableTensor.from_tensor(rel_time)).numerical
Setting Error
fullgraph=True Unsupported: torch.* op returned non-Tensor involving storage_offset()
fullgraph=False InternalTorchDynamoError: AttributeError: 'StringTensor' object has no attribute '_valid'

rel_time is already a tensor. Wrapping it constructs auxiliary SDM containers that obstruct tracing. Extract the existing Standardize fit/transform arithmetic into shared tensor helpers and call them directly. Normalization, fitted state, and missing-value handling are unchanged; the arithmetic remains compiled.

CPU validation 2.7.1 2.14
Relative-time fit and cached transform, Inductor, both fullgraph settings Pass Pass
Existing Standardize tests 5 passed 5 passed

Focused checks include missing timestamps, constant columns, and entirely missing columns. Combined with the separate graph-preparation change, the equivalent prototype also passed pretrained RelBench cached prediction in both compilation modes, with maximum absolute differences from eager of 1.52e-6 / 4.08e-6; eager predictions exactly matched main. Full-model compiled fitting and GPU execution are not validated here.

@copy-pr-bot

copy-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@aw471
aw471 marked this pull request as ready for review October 7, 2026 12:49
Reuse Standardize tensor operations directly inside the relational model, preserving fitted statistics and missing-value handling. Avoid constructing TableTensor auxiliary containers during compilation.
@aw471
aw471 force-pushed the kumorelational-compile-relative-time branch from c3dbbe7 to 2585807 Compare October 7, 2026 12:53
@aw471
aw471 changed the base branch from kumorelational-compile-graph-preparation to main October 7, 2026 12:53
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/structured-data-models/.coderabbit.yaml
  • Review profile: QUIET
  • Plan: Enterprise
  • Run ID: e72f8162-0448-4ba8-8931-49960cab34d8
📥 Commits

Reviewing files that changed from the base of the PR and between 13efce3 and 2585807.

📒 Files selected for processing (2)
  • sdm/models/kumo/relational/model.py
  • sdm/processing/numerical/standardize.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Refactor
    • Updated how relative-time values are standardized during processing. Existing standardization results and handling of missing values are preserved. These changes do not alter user-facing functionality.

Walkthrough

Standardize now fits and transforms numerical tensors through dedicated helpers. The Kumo relational model uses these tensor-level methods for relative-time tensors.

Changes

Tensor-level standardization

Layer / File(s) Summary
Tensor helpers and relative-time usage
sdm/processing/numerical/standardize.py, sdm/models/kumo/relational/model.py
Standardize delegates numerical fitting and transformation to tensor helpers. _get_rel_time fits and transforms rel_time directly instead of wrapping it in TableTensor.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 25858

Relative-time normalization retains its fitted-state handling and shared tensor arithmetic; no actionable merge-blocking regression is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: avoiding table construction during KumoRelational relative-time normalization.
Description check ✅ Passed The description explains the compilation failure, the tensor-helper approach, and the validation scope. It is directly related to the changeset.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant