File "train_lcqmc_cls.py", line 158, in
main()
File "train_lcqmc_cls.py", line 147, in main
callbacks=[evaluator]
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 66, in _method_wrapper
return method(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 815, in fit
model=self)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 1112, in init
model=model)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 772, in init
peek, x = self._peek_and_restore(x)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 830, in _peek_and_restore
peek = next(x)
File "/usr/local/lib/python3.6/dist-packages/bert4keras/snippets.py", line 250, in forfit
for d in self.iter(True):
File "train_lcqmc_cls.py", line 56, in iter
for is_end, (text1, text2, label) in self.sample(random):
AttributeError: 'data_generator' object has no attribute 'sample'
基本信息
核心代码
train_lcqmc_cls.py 等于 task_sentence_similarity_lcqmc.py
python3 train_lcqmc_cls.py
输出信息
File "train_lcqmc_cls.py", line 158, in
main()
File "train_lcqmc_cls.py", line 147, in main
callbacks=[evaluator]
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 66, in _method_wrapper
return method(self, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 815, in fit
model=self)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 1112, in init
model=model)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 772, in init
peek, x = self._peek_and_restore(x)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 830, in _peek_and_restore
peek = next(x)
File "/usr/local/lib/python3.6/dist-packages/bert4keras/snippets.py", line 250, in forfit
for d in self.iter(True):
File "train_lcqmc_cls.py", line 56, in iter
for is_end, (text1, text2, label) in self.sample(random):
AttributeError: 'data_generator' object has no attribute 'sample'
自我尝试
找个另外的电脑升级到tf=2.4+,然后使用tf.keras可以解决,但是目前物理GPU集群仅支持tf=2.3.1以下,因此还需要解决这个问题。