I encountered such a problem when the model is successfully trained, but at the same time I cannot save the trained model inside the callback and the following error pops up (_pickle.PicklingError: Can’t pickle <function error at 0x7f1ebbd3b820>: import of module ‘pages.dashboard.experiment’ failed).
You can reproduce the following code in your conscious and felt pain on yourself
This error happens in multipage application
here is the minimal code
@callback(
Output(...),
Input(..),
)
def example_def(_):
...
cls = autosklearn.classification.AutoSklearnClassifier(
time_left_for_this_task=120,
per_run_time_limit=30,
scoring_functions=[roc_auc],
)
cls.fit(X_train, y_train)
pickle.dump(cls, open('AUTOSKLEARN.pkl', "wb"))
#with open('classifier.pkl', 'wb') as f:
# pickle.dump(cls, f)
# joblib.dump(cls, 'final_model.joblib')