一、run_classifier.py文件
#chang 1:引入horovod
import horovod.tensorflow as hvd
...
def get_train_examples(self, data_dir):
"""See base class."""
file_path = os.path.join(data_dir, "train_bert.txt")
#chang 2 修改训练数据创建方式
return self._create_examples_train(file_path, "train")
#...
def get_labels(self):
"""See base class."""
return ["0", "1"]
#chang 3 新增训练数据创建代码
def _create_examples_train(self, file_path, set_type):
"""Creates examples for the training and dev sets."""
examples = []
for (i, line) in enumerate(codecs.open(