lobbie lobbie
11/04/2023, 11:39 AM[model_name]_[suffix].ckpt
[model_name]_[suffix].pkl
Is it possible to save these using custom names? I need to follow some standard naming convention and I don't want to manually rename the files.
Also, when I saved the models as per documentation, it did not save the 3 models with their respective suffix. i only get 2 files instead of 6. is there something i am not doing right?
Thanks,José Morales
11/06/2023, 3:55 PMsave_dataset=True
)lobbie lobbie
11/06/2023, 10:04 PMnf.save(path='./checkpoints/test_run/',
model_index=None,
overwrite=True,
save_dataset=True)
The model files saved were,
automlp_0.ckpt
configuration.pkl
dataset.pkl
nbeats_0.ckpt
nhits_0.ckpt
I noticed the saved files do not have the following pkl files as per documentation. Does the saved configuration.pkl covers all 3 models?
automlp_0.pkl
nbeats_0.pkl
nhits_0.pkl
I would like to use my own custom model filenames. Is this possible? If yes, what should the code be like?
Acc_Model_UV_automlp_0.pkl
Acc_Model_UV_automlp_0.ckpt
Acc_Model_UV_nbeats_0.pkl
Acc_Model_UV_nbeats_0.ckpt
Acc_Model_UV_nhits_0.pkl
Acc_Model_UV_nhits_0.ckpt
Thanks.José Morales
11/06/2023, 10:53 PMnf.save(path, model_index=[]) # this doesn't save the models
for model in self.models:
model.save(your_custom_path)
load:
from neuralforecast.core import MODEL_FILENAME_DICT
nf = NeuralForecast.load(path)
for fname in your_custom_path:
# extract the model name from the filename
model_name = fname.split('_')[3] # this would extract the automlp model from your sample path (Acc_Model_UV_automlp_0.pkl)
model = MODEL_FILENAME_DICT[model_name].load_from_checkpoint(fname)
nf.models.append(model)
lobbie lobbie
11/06/2023, 11:17 PMJosé Morales
11/06/2023, 11:18 PMnf.predict(new_df)
then you don't need it. If you do need it you can use the snippets I provided above and those will save and load the configurationlobbie lobbie
11/08/2023, 8:07 AMJosé Morales
11/08/2023, 3:57 PMnf = NeuralForecast(...)
...
with open('nf.pkl', 'wb') as f:
pickle.dump(nf, f)
that'd have the dataset, models, etclobbie lobbie
11/09/2023, 6:52 AM