Skip to content

Implementing Fine-Tuning and Prompt-Tuning for TabPFN #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

tleemann
Copy link

@tleemann tleemann commented Apr 10, 2025

Creating a pull request for Finetuning and Prompt tuning.

What has not been done yet, but might be nice to have:

Create tests, check typing with mypy

@CLAassistant
Copy link

CLAassistant commented Apr 10, 2025

CLA assistant check
All committers have signed the CLA.

@iivalchev
Copy link

iivalchev commented Apr 12, 2025

@tleemann Kudos for making the effort! Please note some work for fine-tunning is being done here: https://github.com/LennartPurucker/finetune_tabpfn_v2, not sure if your approach is somewhat different but the change looks quite large. In the repo referenced the goal is not to interfere with the main code base for the purposes of fine-tuning.

@tleemann
Copy link
Author

tleemann commented Apr 12, 2025

@tleemann Kudos for making the effort! Please note some work for fine-tunning is being done here: https://github.com/LennartPurucker/finetune_tabpfn_v2, not sure if your approach is somewhat different but the change looks quite large. In the repo referenced the goal is not to interfere with the main code base for the purposes of fine-tuning.

@iivalchev Thanks for pointing to your codebase! Don't worry, I was in touch with the maintainers before creating this request.
We thought it could be nice to additionally have native fine-tuning support with the changes in this request, which directly allows for:

  • Finetuning on multiple datasets
  • Efficient parallel preprocessing of multiple datasets in native torch.DataLoaders
  • Prompt-Tuning

@iivalchev
Copy link

Right! I am quite keen on the strategies for training on multiple datasets. Is there anything done in that regard?

@tleemann
Copy link
Author

Yes, that's a challenging task. The idea here was to preprocess the datasets offline for additional speed through parallelism (preprocessing uses numpy). The classifier now has a get_preprocessed_datasets-function, which returns a Meta-Dataset that can be used in a torch.utils.data.DataLoader to quickly load different preprocessed datasets (or batches of a single dataset) for finetuning.

Please have a look at the example in examples/tabpfn_finetune.py (in the request), where I tried to give an example of the usage (the example only uses one dataset, but it can be easily extended by just passing a list of datasets the get_preprocessed_datasets-function). Hope this helps.

Best,
Tobias

@tleemann tleemann changed the title Implementing Fine-Tuning and Prompt Tuning for TabPFN Implementing Fine-Tuning and Prompt-Tuning for TabPFN Apr 12, 2025
@iivalchev
Copy link

Cool! Will do so. Do you think test-time training can also be accommodated? And I assume fine-tunning for the regressor would also be supported?

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.

4 participants