{"id":24473,"library":"pytorch-tabnet","title":"PyTorch TabNet","description":"PyTorch implementation of TabNet (Google's attention-based tabular network). Current version 4.1.0, with semi-annual releases. Supports classification, regression, and unsupervised pre-training.","status":"active","version":"4.1.0","language":"python","source_language":"en","source_url":"https://github.com/dreamquark-ai/tabnet","tags":["tabular","deep-learning","pytorch","tabnet","classification","regression"],"install":[{"cmd":"pip install pytorch-tabnet","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"Correct import after v2.0.0","symbol":"TabNetClassifier","correct":"from pytorch_tabnet.tab_model import TabNetClassifier"}],"quickstart":{"code":"from pytorch_tabnet.tab_model import TabNetClassifier\nimport numpy as np\n\nX_train = np.random.rand(100, 10)\ny_train = np.random.randint(0, 2, 100)\n\nclf = TabNetClassifier(device_name='cpu')\nclf.fit(X_train, y_train, max_epochs=10)\nprint(clf.predict(X_train))","lang":"python","description":"Minimal example of fitting a TabNetClassifier on random data."},"warnings":[{"fix":"Retrain any models that used unsupervised pretraining after upgrading to v4.x.","message":"In v4.0, the unsupervised pretraining loss was changed to match the original paper. Models trained with pretraining in v3.x cannot be directly resumed or fine-tuned in v4.x without retraining.","severity":"breaking","affected_versions":"v4.0+"},{"fix":"Explicitly set the `eval_metric` parameter to 'mse' to retain old behavior.","message":"The default metric for regression changed from 'mse' to 'rmse' in v3.0.0. If you relied on default metric behavior, your training/evaluation results may differ.","severity":"breaking","affected_versions":"v3.0.0+"},{"fix":"Ensure `len(cat_idxs) == len(cat_dims)` and that each index corresponds to a valid column.","message":"When using categorical features, `cat_idxs` and `cat_dims` must be consistent. An error is raised only in v4.0+ if they are incoherent.","severity":"gotcha","affected_versions":">=4.0"},{"fix":"Use clf.save_model('model.pt') and clf.load_model('model.pt').","message":"Saving and loading models: use `save_model` and `load_model` methods. Directly pickling the model object is not supported and may break.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install with: pip install pytorch-tabnet. Import as: from pytorch_tabnet.tab_model import TabNetClassifier","cause":"Incorrect pip package name (missing hyphen) or import path.","error":"ModuleNotFoundError: No module named 'pytorch_tabnet'"},{"fix":"Upgrade to latest version: pip install --upgrade pytorch-tabnet","cause":"Old version; categorical embedding was not supported before v1.1.0.","error":"TypeError: __init__() got an unexpected keyword argument 'cat_idxs'"},{"fix":"Convert y_train to integer type: y_train = y_train.astype(np.int64)","cause":"Target labels for classification are float instead of integer/long.","error":"RuntimeError: expected scalar type Long but found Float"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}