报错如下:
Traceback (most recent call last):
File "run_classifier1.py", line 1018, in <module>
tf.app.run()
File "D:\professionaltoolfolder\Miniconda3-latest-Windows-x86_64\envs\tf112gpu_py37\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "run_classifier1.py", line 836, in main
if FLAGS.max_seg_length > bert_config.max_position_embeddings:
File "D:\professionaltoolfolder\Miniconda3-latest-Windows-x86_64\envs\tf112gpu_py37\lib\site-packages\tensorflow\python\platform\flags.py", line 85, in __getattr__
return wrapped.__getattr__(name)
File "D:\professionaltoolfolder\Miniconda3-latest-Windows-x86_64\envs\tf112gpu_py37\lib\site-packages\absl\flags\_flagvalues.py", line 472, in __getattr__
raise AttributeError(name)
AttributeError: max_seg_length
实际错误行在:
flags.DEFINE_integer("save_checkpoints_steps", 1000, "How often to save the model checkpoint.") # save_checkpoints_steps
错误分析:
导致AttributeError(属性错误)的原因主要有两种:1、定义对象属性与调用对象属性的名称不一致!(本次错误是save_checkpoints_steps少写一个s);2、缩进不一致导致属性丢失!