unit8co / darts

A python library for user-friendly forecasting and anomaly detection on time series.
https://unit8co.github.io/darts/
Apache License 2.0
7.89k stars 854 forks source link

[BUG] (TransformerModel) TypeError: __init__() got an unexpected keyword argument 'save_checkpotins' #566

Closed DataWaveAnalytics closed 2 years ago

DataWaveAnalytics commented 2 years ago

System (please complete the following information):

I'm trying to run the notebook called 07-Transformer-examples.ipynb but I'm getting the following error trying to create a TransformerModel

my_model = TransformerModel(
    input_chunk_length = 12,
    output_chunk_length = 1,
    batch_size = 32,
    n_epochs = 400,
    model_name = 'air_transformer',
    log_tensorboard=True,
    nr_epochs_val_period = 10,
    d_model = 32,
    nhead = 16,
    num_encoder_layers = 3,
    num_decoder_layers = 3,
    dim_feedforward = 512,
    dropout = 0.1,
    activation = "relu",
    random_state=42,
    save_checkpotins=True
)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_6360/2331143881.py in <module>
     15     activation = "relu",
     16     random_state=42,
---> 17     save_checkpotins=True
     18 )

~\sources\darts\darts\models\forecasting\forecasting_model.py in __call__(cls, *args, **kwargs)
     39     def __call__(cls, *args, **kwargs):
     40         cls.model_call = (args, kwargs)
---> 41         return super(ModelMeta, cls).__call__(*args, **kwargs)
     42 
     43 

~\sources\darts\darts\utils\torch.py in decorator(self, *args, **kwargs)
     63         with fork_rng():
     64             manual_seed(self._random_instance.randint(0, high=MAX_TORCH_SEED_VALUE))
---> 65             return decorated(self, *args, **kwargs)
     66     return decorator

~\sources\darts\darts\models\forecasting\transformer_model.py in __init__(self, input_chunk_length, output_chunk_length, d_model, nhead, num_encoder_layers, num_decoder_layers, dim_feedforward, dropout, activation, custom_encoder, custom_decoder, likelihood, random_state, **kwargs)
    311         kwargs['input_chunk_length'] = input_chunk_length
    312         kwargs['output_chunk_length'] = output_chunk_length
--> 313         super().__init__(likelihood=likelihood, **kwargs)
    314 
    315         self.input_chunk_length = input_chunk_length

~\sources\darts\darts\models\forecasting\torch_forecasting_model.py in __init__(self, likelihood, **kwargs)
   1060             The likelihood model to be used for probabilistic forecasts.
   1061         """
-> 1062         super().__init__(**kwargs)
   1063         self.likelihood = likelihood
   1064 

TypeError: __init__() got an unexpected keyword argument 'save_checkpotins'
dennisbader commented 2 years ago

Hi @DataWaveAnalytics, and thanks for writing.

Yes, we made a spelling mistake there. Try replacing save_checkpotins with save_checkpoints.

zhongxianmen2020 commented 2 years ago

model_nbeats = NBEATSModel( input_chunk_length=length2, output_chunk_length=1, generic_architecture=True, num_stacks=2, num_blocks=1, num_layers=layer2, layer_widths=layer_width2, n_epochs=epoch2, nr_epochs_val_period=1, batch_size=10, random_state=2022, model_name="nbeats_run" )

ypeError: init() got an unexpected keyword argument 'random_state'

How to fix this problem in darts? How to set random_state?