RASA Chatbot Framework gives error while training :fit() got multiple values for keyword argument 'batch_size'

Viewed 1416

I was trying to train the Chat Bot built with rasa using the snippet

agent.train(data,augmentation_factor=50,
        epochs=500,
        batch_size=10)

and got the following error. I Know its not rasa_core error but something related to keras probably.

rasa_core/policies/keras_policy.py", line 177, in train
    **params)
TypeError: fit() got multiple values for keyword argument 'batch_size'

I am new to bot building and never done in deep learning Project before that.Using following dependencies rasa_core==0.12.x keras==2.1.6

2 Answers

I had the same error and after several search I did find a solution. It is not the best solution but it can help!

Go to rasa_core\rasa_core\policies\keras_policy.py in lines 172-177 and delete epochs and batch_size arguemnts from model.fit. Change this:

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

to this :

    params = self._get_valid_params(self.model.fit, **kwargs)
    self.model.fit(shuffled_X, shuffled_y,**params)

Then you can pass epochos and batch_size arguments in agent.train()

I hope it will help!

My friend had the same issue. He has latest version of rasa_core installed. However the keras_policy.py got similar issue. I gave him my version of keras_policy.py and he replaced it with my version and it worked. I know it is not right solution, but you can use that as work around

Related