0

I’m running Optuna to tune hyperparameters for a TabM regression model (10 trials) on Kaggle (GPU: Tesla P100) to minimize RMSE. The optimization runs fine — all trials complete — but right after finishing, the notebook fails with a FutureWarning from the traitlets package. After this error, no subsequent cells (like saving trial results to CSV) can run.

Here’s the main part of my Optuna code:

import optuna
from optuna.storages import RDBStorage
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
study_name = "tabm_tuning"
study = optuna.create_study(
 study_name=study_name,
 direction="minimize",
 storage=RDBStorage(url=f"sqlite:///{study_name}.db")
)
# enqueue one predefined parameter set
study.enqueue_trial(params_2)
# run optimization for 10 trials (example)
study.optimize(
 lambda trial: objective(trial, X_train, y_train, X_val, y_val),
 n_trials=10,
 timeout=41710
) # use of timeout to prevent runtime out error
study.best_params
df_trial=study.trials_dataframe()
df_trial.to_csv(f'{study_name}_df.csv',index=False)
df_trial

Everything runs smoothly until the end of the trials, where this warning appears and the notebook crashes:

[I 2025年10月27日 14:50:51,477] Trial 9 finished with value: 0.05611381708907078 and parameters: {'patience': 15, 'tabm_k': 112, 'gradient_clipping_norm': 0.915269632521597, 'lr': 0.0008291955423479689, 'weight_decay': 0.007870223162632283, 'n_blocks': 5, 'd_block': 210, 'dropout': 0.35379749466109023, 'd_embedding': 11}. Best is trial 5 with value: 0.056029200575024675.
20800.4s /usr/local/lib/python3.11/dist-packages/traitlets/traitlets.py:2915: FutureWarning: 
--Exporter.preprocessors=["remove_papermill_header.RemovePapermillHeader"] for containers 
is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times.
20803.4s /usr/local/lib/python3.11/dist-packages/traitlets/traitlets.py:2915: FutureWarning: 
--Exporter.preprocessors=["nbconvert.preprocessors.ExtractOutputPreprocessor"] for containers 
is deprecated in traitlets 5.0.
20804.2s Traceback (most recent call last):
20804.2s File "/usr/local/bin/jupyter-nbconvert", line 10, in <module>

After this, the notebook stops executing completely.

Question

How can I prevent or safely handle this FutureWarning from traitlets (triggered by nbconvert) so my Kaggle notebook doesn’t crash after Optuna finishes? Is there a reliable workaround or fix for this in Kaggle / Jupyter environments?

asked Oct 30, 2025 at 16:09
1
  • Try to add these warning: warnings.filterwarnings("ignore", module="traitlets") warnings.filterwarnings("ignore", module="nbconvert") and run again. OR you can disable the autosave and checkpoint, but using %%javascript Jupyter.notebook.set_autosave_interval(0) Commented Oct 30, 2025 at 16:55

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.