(Solved) Issues training Python AI chatbot

Hello there guys. I have no idea if this is the best place to ask about this but I'll go ahead anyway.


So I am trying to make an AI chatbot using Python, in a Pycharm IDLE. While trying to start training the neural network that would enable the chatbot to work, I ran into this error and was unable to find any resources I could use to help me solve this:

Traceback (most recent call last):
File "C:\Users\Owner\PycharmProjects\ai\main.py", line 71, in model.compile(loss='categorical_crossentropy', optimiser=sgd, metrics=['accuracy'])

File "C:\Users\Owner\AppData\Roaming\Python\Python39\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler raise e.with_traceback(filtered_tb) from None

File "C:\Users\Owner\AppData\Roaming\Python\Python39\site-packages\keras\engine\training.py", line 2983, in _validate_compile raise TypeError('Invalid keyword argument(s) in `compile()`: '

TypeError: Invalid keyword argument(s) in `compile()`: ({'optimiser'},). Valid keyword arguments include "cloning", "experimental_run_tf_function", "distribute", "target_tensors", or "sample_weight_mode".

Original Code

ie the code where the error occured

sgd = gradient_descent_v2.SGD(learning_rate=0.01, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy', optimiser=sgd, metrics=['accuracy'])

If anybody knows how to solve this, please tell me!

The keyword is optimizer, not optimiser.

From keras.io:

Model.compile(
    optimizer="rmsprop",
    loss=None,
    metrics=None,
    loss_weights=None,
    weighted_metrics=None,
    run_eagerly=None,
    steps_per_execution=None,
    **kwargs
)

Thank you, I’ve just realised this.