TyperError in Keras Policy

I got the same error while I wanted to retrain my core (dialogue) model. The error stems for example from this line when you are training a KerasPolicy: rasa_core/keras_policy.py at master · RasaHQ/rasa_core · GitHub

# filter out kwargs that cannot be passed to fit
params = self._get_valid_params(self.model.fit, **kwargs)

whereas the self._get_valid_params( … ) method is implemented for all policies and does not correctly filter out the params (or does it?). Well, at least we end up with the issue/error @this-is-r-gaurav mentioned.

May I suggest to additionally update the kwargs or params (whatever shall take precedence) to fix the issue? For line rasa_core/keras_policy.py at master · RasaHQ/rasa_core · GitHub and following this would change the code piece

self.model.fit(shuffled_X, shuffled_y,
    epochs=self.epochs,
    batch_size=self.batch_size,
    **params)

to

self.model.fit(shuffled_X, shuffled_y,
    **{'epochs': self.epochs, 'batch_size': self.batch_size, **params})  # params take precedence

What do you people think?