-
Notifications
You must be signed in to change notification settings - Fork 166
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
save an ICL tuned model #106
Comments
We had a similar decision on our Discord before, take a look at https://discord.com/channels/1285598202732482621/1316254428654866462 and let me know if it works for you! |
In summary from the Discord discussion, you can save the model with pickle as expected: from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
import pickle
from tabpfn import TabPFNClassifier
# Load data
X, y = load_breast_cancer(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)
# Train classifier
classifier = TabPFNClassifier(device='cpu')
classifier.fit(X_train, y_train)
# Save the trained classifier to a file
with open('tabpfn_classifier.pkl', 'wb') as f:
pickle.dump(classifier, f)
# Can be in a separate code
# Load the classifier from the file
with open('tabpfn_classifier.pkl', 'rb') as f:
loaded_classifier = pickle.load(f)
# Predict
y_pred, p_pred = loaded_classifier.predict(X_test) |
I'd keep this open until we've properly documented it @LennartPurucker right? |
Mhm, we are not diverging from the default, so I do not know if we need extra documentation. Let us keep it open for now. |
How can a fitted model be saved? For example, scikit learn models can generally be exported to disk by using joblib or cloudpickle as noted here
Thanks for the amazing work.
The text was updated successfully, but these errors were encountered: