Autogluon's predict function tries to load model.pkl from the wrong path

442 views Asked by At

I'm using Autogluon package to train some models and then make predictions. The file structure in my project looks like this:

enter image description here

There is a folder called "Models" where I'm storing models for different chemical analytes. In each analyte's folder there is a learner.pkl, predictor.pkl, and a folder called "models" with trained models and trainer.pkl

Everything works fine until I call predict() method on TabularPredictor.


model_savepath = "Models/ascorbic acid-model"
model = TabularPredictor.load(model_savepath, require_version_match=False, verbosity=4)

to_predict = data_to_train.iloc[[0]].drop("Final", axis=1)
model.predict(to_predict)

Then I'm getting the following error:


FileNotFoundError: [Errno 2] No such file or directory: 'Models/ascorbic acid-model/models//WeightedEnsemble_L2model.pkl'

For some reason the file name is mixed with the folder name. It says it tries to load weightedensemble_L2model.pkl instead of weighedensemble_L2/model.pkl.

Why is that?

I tried changing the path or training model on linux instead of windows, nothing worked so far.

0

There are 0 answers