Skip to content

Add TabFM and fix foundation-model integration bugs#111

Open
andreasgoethals wants to merge 2 commits into
LAMDA-Tabular:mainfrom
andreasgoethals:main
Open

Add TabFM and fix foundation-model integration bugs#111
andreasgoethals wants to merge 2 commits into
LAMDA-Tabular:mainfrom
andreasgoethals:main

Conversation

@andreasgoethals

Copy link
Copy Markdown
Contributor

Add TabFM and fix foundation-model integration bugs

Summary

  • Add tabfm, an optional Google Research TabFM v1.0.0 method wrapper using the upstream tabfm[pytorch] package.
  • Register tabfm in the unified method registry and add matching default / opt-space configs.
  • Document TabFM in the README, including the optional install command and the upstream non-commercial model-weight license caveat.
  • Fix TALENT/configs/opt_space/tabptm.json, whose top-level key incorrectly pointed to tabpfn.
  • Fix shared preprocessing edge cases:
    • unknown categorical values now map to the training-column mode as documented;
    • constant regression targets no longer divide by zero during label normalization.
  • Fix Python API argument handling so TALENT.run(..., args=...) respects supplied seed, seed_num, tune, n_trials, and tune_metric fields unless explicitly overridden.
  • Make TabPTM temporary tensors follow the active device instead of hardcoding CUDA.

Notes

  • tabfm is optional and not added as a hard dependency. Users should install it with:

    pip install -U "tabfm[pytorch]"
  • TabFM v1.0.0 classification is limited to 10 classes by the upstream model. The wrapper raises a clear ValueError before loading the model if a dataset exceeds that limit.

  • The wrapper uses the PyTorch backend because TALENT already centers on PyTorch and the upstream TabFM package exposes tabfm_v1_0_0_pytorch.

  • The upstream TabFM source code is Apache 2.0, while the published model weights are under the TabFM Non-Commercial License.

Validation

  • python -m compileall -q TALENT test
  • git diff --check
  • Registry/config consistency check:
    • 56 registered methods;
    • no missing config files;
    • no mismatched config top-level keys.
  • Focused preprocessing checks for categorical unknown replacement and constant regression target normalization.
  • API behavior check confirming args.tune=True is now honored by TALENT.run(..., args=...).

Follow-Up

  • Full runtime smoke tests for tabfm require installing tabfm[pytorch] and downloading the upstream Hugging Face weights.
  • Consider adding a lightweight CI test that checks registry/config consistency for every registered method.

Copilot AI review requested due to automatic review settings July 7, 2026 09:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new optional TabFM method integration to TALENT’s unified method registry/config system, while also fixing several integration and preprocessing edge cases that affect foundation-model wrappers and the Python API.

Changes:

  • Added a tabfm method wrapper (optional dependency) and registered it with matching default + opt-space configs.
  • Fixed preprocessing edge cases (unknown categorical replacement and constant regression-target normalization).
  • Fixed Python API TALENT.run(..., args=...) override/default handling and improved device handling in TabPTM temporary tensors.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
TALENT/model/methods/tabptm.py Makes temporary tensors device-aware (no hardcoded .cuda()), plus trailing whitespace cleanup.
TALENT/model/methods/tabfm.py Adds a new TabFM wrapper (optional tabfm[pytorch]) for zero-shot classification/regression.
TALENT/model/method_registry.py Registers tabfm in the unified method registry with constraints and notes.
TALENT/model/lib/data.py Fixes unknown-categorical replacement logic and guards against divide-by-zero in regression label normalization.
TALENT/configs/opt_space/tabptm.json Fixes incorrect top-level key (tabpfntabptm).
TALENT/configs/opt_space/tabfm.json Adds TabFM opt-space config stub + general defaults.
TALENT/configs/default/tabfm.json Adds TabFM default config stub + general defaults.
TALENT/api.py Updates run() kwarg/args precedence logic for seeds and tuning fields.
readme.md Documents TabFM as an optional method and updates the foundation-model cap note + acknowledgements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread TALENT/api.py
Comment on lines +457 to +461
args.seed = getattr(args, "seed", 0)
args.seed_num = getattr(args, "seed_num", 1)
args.tune = getattr(args, "tune", False)
args.n_trials = getattr(args, "n_trials", 50)
args.tune_metric = getattr(args, "tune_metric", None)
Comment on lines +231 to +234
else:
vl = self.criterion(
torch.tensor(test_logit), torch.tensor(test_label)
).item()
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.

2 participants