TabPFN can be used in two ways, depending on your workflow and compute setup. Use the API for our hosted service and for production use. For testing and if you have GPUs, install the open-source package from Hugging Face.
Recommended for researchers, ML practitioners, and engineers with GPU availability. TabPFN is available as an open-source Python package on GitHub with the checkpoint for non-commercial use hosted on HuggingFace. It provides the model locally, giving you full control over your data and experimentation.
Copy
Ask AI
pip install tabpfn
To get access to the latest features and our TabPFN-2.5 model, please upgrade the package to the latest version:
Recommended for data teams and developers who want TabPFN’s performance without managing infrastructure. The Prior Labs API provides cloud-hosted access to TabPFN-2.5 and manages GPU compute, scaling, and model versioning. You can use it either through a REST API or the Python SDK.
Instantiate the hosted TabPFNClassifier for API-backed predictions:
Copy
Ask AI
from tabpfn_client import TabPFNClassifier# Use TabPFN like any scikit-learn modelmodel = TabPFNClassifier()model.fit(X_train, y_train)# Get predictionspreds = model.predict(X_test)
Authentication
To authenticate you can run a prediction, which will prompt you to sign in if needed. To log in programmatically, follow these steps:
You must sign up and generate an API key before making any requests. Requests without valid authentication headers will be rejected. For more information, visit the API Reference.
First, define your dataset paths and authentication details. This allows you to reuse them across fit and predict calls.
Copy
Ask AI
import os, json, requests# Define your file pathstrain_path = "train.csv" # path to your training datasettest_path = "test.csv" # path to your test dataset# Get your API key from the environmentapi_key = os.getenv("PRIORLABS_API_KEY")headers = {"Authorization": f"Bearer {api_key}"}
Next, upload your training dataset to the /v1/fit endpoint. The API automatically preprocesses the data.
Once fitted, you can send your test dataset to the /v1/predict endpoint using the returned model_id. You’ll receive predictions and/or probabilities in JSON format.
Ensure your installation is up to date: pip install -U tabpfn
Instantiate the classifier or regressor:
Copy
Ask AI
from tapfn import TabPFNClassifier, TabPFNRegressorfrom tabpfn.constants import ModelVersion# Set the version of the TabPFNClassifier to 2.5classifier = TabPFNClassifier.get_default_for_version(ModelVersion.V2_5)# Set the version of the TabPFNRegressor to 2.5regressor = TabPFNRegressor.get_default_for_version(ModelVersion.V2_5)
Ensure your installation is up to date: pip install -U tabpfn-client
Instantiate the classifier or regressor:
Copy
Ask AI
from tabpfn_client.estimator import TabPFNClassifierfrom tabpfn_client.constants import ModelVersion# Set the version of the TabPFNClassifier to 2.5classifier = TabPFNClassifier.get_default_for_version(ModelVersion.V2_5)
Alternatively, a variety of models can be selected using the model_path option:
Copy
Ask AI
from tabpfn_client import TabPFNClassifier# View the models availableprint(TabPFNClassifier().list_available_models())# Create a classifier or regressor using a particular modelclassifier = TabPFNClassifier(model_path="v2.5_real")