TabFM constructor accepts zero/negative dimensions; col_num_blocks=0 builds a model with no attention blocks
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- python, pytorch
- Domain
- machine-learning
Research direction
Start at the TabFM constructor (init) and reproduce the reported zero and negative dimension cases in a clean container. Check how the dimensional parameters reach PyTorch and ModuleList construction; done means non-positive inputs produce one clear tabfm validation error rather than building empty attention blocks or failing with an unrelated tensor-shape message.
Written by the indexing model from the issue text.
Description
Separate from #91 (which is about config.json keys being merged in unvalidated) — this is about the constructor itself, and it affects anyone calling TabFM(...) directly in Python.
I tested every dimensional parameter at 0 and -1 on b15593e4c1111ddb5f4f30dd2957df2edbaa04ca, in a clean container. Ten of thirteen accept 0 and build a model with no error. Three accept -1 as well.
param value outcome
------------------------------------------------------------------------
embed_dim 0 BUILT OK (no validation)
embed_dim -1 RuntimeError: Trying to create tensor with negative di
max_classes 0 BUILT OK (no validation)
max_classes -1 RuntimeError: Trying to create tensor with negative di
col_num_blocks 0 BUILT OK (no validation)
col_num_blocks -1 BUILT OK (no validation)
col_nhead 0 ZeroDivisionError
col_nhead -1 RuntimeError: Trying to create tensor with negative di
col_num_inds 0 BUILT OK (no validation)
col_num_inds -1 RuntimeError: zeros: Dimension size must be non-negati
row_num_blocks 0 BUILT OK (no validation)
row_num_blocks -1 BUILT OK (no validation)
row_nhead 0 ZeroDivisionError
row_nhead -1 RuntimeError: upper bound and lower bound inconsistent
row_num_cls 0 BUILT OK (no validation)
row_num_cls -1 RuntimeError: zeros: Dimension size must be non-negati
icl_num_blocks 0 BUILT OK (no validation)
icl_num_blocks -1 BUILT OK (no validation)
icl_nhead 0 ZeroDivisionError
icl_nhead -1 RuntimeError: Trying to create tensor with negative di
ff_factor 0 BUILT OK (no validation)
ff_factor -1 RuntimeError: Trying to create tensor with negative di
feature_group_size 0 BUILT OK (no validation)
feature_group_size -1 RuntimeError: zeros: Dimension size must be non-negati
num_freq 0 BUILT OK (no validation)
num_freq -1 RuntimeError: zeros: Dimension size must be non-negati
The one I would draw your attention to is *_num_blocks. Passing 0 or -1 makes range(...) empty, so the ModuleList is empty and the model is built with no attention blocks at all. It still runs and still returns predictions. Nothing warns. That is a worse outcome than the crashes elsewhere in the table, because a crash is at least honest about what happened.
Where errors do occur they come from PyTorch rather than from tabfm, so the message describes a tensor shape rather than the parameter the caller actually got wrong — Trying to create tensor with negative dimension does not tell someone that ff_factor was the problem.
A small guard at the top of __init__ rejecting non-positive values for these parameters would turn all twenty-six rows into one clear message. I am happy to send that PR if you would like it — I did not want to presume which parameters you consider legitimately zero-able (decoder_hidden is already None-able, so there may be others by design).
Disclosure: I used an AI assistant to help find this. I ran the matrix myself.
- Dominant language
- Python
- Stars
- 2.7k
- Forks
- 275
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google-research/tabfm
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
google-research/tabfm#100 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
google-research/tabfm#93 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
google-research/tabfm#89 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
google-research/tabfm#95 ·
-
Estimators define no _parameter_constraints; all 13 numeric parameters accept 0 and negative values Open
Difficulty 3/5 1-2 days Newbie friendliness 64/100
google-research/tabfm#94 ·
All issues in google-research/tabfm
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100