使用内置方法进行训练 TypeError: 'NoneType' object is not callable

时间:2021-05-30 13:16:50

标签: python machine-learning google-colaboratory

我正在尝试为我的项目训练模型,但出现以下错误:

Epoch 1/100
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-43-453b6e87854a> in <module>()
      6                     batch_size=batch_size,
      7                     validation_data=([q1_X_test, q2_X_test], y_test),
----> 8                     callbacks=[checkpoint,es,reduce_alpha])

2 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds)
    915       # In this case we have created variables on the first call, so we run the
    916       # defunned version which is guaranteed to never create variables.
--> 917       return self._stateless_fn(*args, **kwds)  # pylint: disable=not-callable
    918     elif self._stateful_fn is not None:
    919       # Release the lock early so that multiple threads can perform the call

TypeError: 'NoneType' object is not callable

我在 google colab 中执行此操作导致此错误的代码如下:

epochs = 100
batch_size = 64
history = model.fit(x=[q1_X_train, q2_X_train],
                    y=y_train,
                    epochs=epochs,
                    batch_size=batch_size,
                    validation_data=([q1_X_test, q2_X_test], y_test),
                    callbacks=[checkpoint,es,reduce_alpha])

我通过打印其值检查了每个变量,它们返回了一些值。请帮我解决这个错误。

0 个答案:

没有答案