SyntaxError: keyword argument repeated in TensorFlow's load_model function
The error 'SyntaxError: keyword argument repeated' occurs in TensorFlow's load_model function when the encoding keyword argument is specified multiple times. This is incorrect as a keyword argument can only be used once.
To resolve this issue, remove one of the encoding arguments. Here's the corrected code:
model = tf.keras.models.load_model('model.h5', encoding='utf-8', compile=False, custom_objects={'<custom_objects>'})
By removing the duplicate encoding argument, the code will execute without raising the error.
原文地址: http://www.cveoy.top/t/topic/pghz 著作权归作者所有。请勿转载和采集!