Open GeorgeXiaojie opened 3 days ago
Hi @GeorgeXiaojie,
I don't see fit()
being called in the code you shared, if it isn't, the model does not exist and there is not much to actually save. Can you try the following:
from darts.models import RegressionEnsembleModel, LightGBMModel, XGBModel
from darts.datasets import AirPassengersDataset
ts = AirPassengersDataset().load()
model = RegressionEnsembleModel(
forecasting_models = [
LightGBMModel(
lags=3,
output_chunk_length=1,
random_state=2022,
),
XGBModel(
lags=3,
output_chunk_length=1,
random_state=2022
)],
regression_train_n_points = 10
)
model.fit(ts)
# works
model.predict(3)
model.save("model.pt")
model_loaded = RegressionEnsembleModel.load("model.pt")
# works as well
model_loaded.predict(3)
Hi @GeorgeXiaojie,
I don't see
fit()
being called in the code you shared, if it isn't, the model does not exist and there is not much to actually save. Can you try the following:from darts.models import RegressionEnsembleModel, LightGBMModel, XGBModel from darts.datasets import AirPassengersDataset ts = AirPassengersDataset().load() model = RegressionEnsembleModel( forecasting_models = [ LightGBMModel( lags=3, output_chunk_length=1, random_state=2022, ), XGBModel( lags=3, output_chunk_length=1, random_state=2022 )], regression_train_n_points = 10 ) model.fit(ts) # works model.predict(3) model.save("model.pt") model_loaded = RegressionEnsembleModel.load("model.pt") # works as well model_loaded.predict(3)
Thank you for your reply. There is a model.fit and I've followed up on the issue.
RegressionEnsembleModel is OK using the predictive models LightGBMModel and XGBModel.
However, RegressionEnsembleModel using TiDEModel and NLinearModel is not working.
Oh thanks for the clarification, managed to reproduce the problem.
It seems like the torch models weights are not being loaded properly, we will investigate this further.
Describe the bug A clear and concise description of what the bug is.
scene1:as below, RegressionEnsembleModel train and predict works
train:
predict:
scene2:as bellow, RegressionEnsembleModel train works, but predict doesn't work, and raises an exception: AttributeError: 'NoneType' object has no attribute 'set_predict_parameters'
train:
predict:
I debugged into the code below and found that self.model is indeed None, I'm not sure if it's because of a bug?
To Reproduce Steps to reproduce the behavior, preferably code snippet.
Expected behavior A clear and concise description of what you expected to happen.
System (please complete the following information):
Additional context Add any other context about the problem here.