TypeError:意外的关键字参数传递给了优化器:name

时间:2019-07-10 14:08:18

标签: python tensorflow keras

我正在尝试加载经过训练的keras模型。该培训是在Google合作实验室完成的,我正在尝试将其加载到计算机上,但是会出现错误。

Keras版本-2.2.4

Tensorflow版本-1.14.0

这些版本与我的计算机和Colab匹配。

我试图使h5py版本匹配,但是在我的计算机上将其降级后,Tensorflow整体上停止工作,因此我取消了该操作。

我该如何解决?

  Traceback (most recent call last):

  File "<ipython-input-14-7e079df22f50>", line 1, in <module>
runfile('C:/Users/Peteris.Zvejnieks/Data/model_tester.py', wdir='C:/Users/Peteris.Zvejnieks/Data')

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/Peteris.Zvejnieks/Data/model_tester.py", line 37, in <module>
models.load_model(model_path)

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\tensorflow\python\keras\engine\saving.py", line 249, in load_model
optimizer_config, custom_objects=custom_objects)

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\tensorflow\python\keras\optimizers.py", line 838, in deserialize
printable_module_name='optimizer')

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 194, in deserialize_keras_object
return cls.from_config(cls_config)

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\tensorflow\python\keras\optimizers.py", line 159, in from_config
return cls(**config)

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\tensorflow\python\keras\optimizers.py", line 471, in __init__
super(Adam, self).__init__(**kwargs)

  File "C:\ProgramData\Anaconda3\envs\tf_build_env\lib\site-packages\tensorflow\python\keras\optimizers.py", line 68, in __init__
'passed to optimizer: ' + str(k))

TypeError: Unexpected keyword argument passed to optimizer: name

错误消息:

{{1}}

0 个答案:

没有答案