Skip to content

Commit

Permalink
命名标准化
Browse files Browse the repository at this point in the history
  • Loading branch information
bojone authored Jul 17, 2020
1 parent 9f6dd86 commit be69691
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions examples/task_conditional_language_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def just_show():
print(random_sentiment.generate(0, 5, 5), '\n')


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.lowest = 1e10

Expand All @@ -158,7 +158,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(data, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_image_caption.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def just_show():
print()


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.lowest = 1e10

Expand All @@ -209,7 +209,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(train_data, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_language_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def just_show():
print(u'结果: %s\n' % ('\n'.join(t)))


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.lowest = 1e10

Expand All @@ -162,7 +162,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(data, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_reading_comprehension_by_mlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def predict_to_file(data, filename):
f.flush()


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.lowest = 1e10

Expand All @@ -212,7 +212,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(train_data, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_reading_comprehension_by_seq2seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def predict_to_file(data, filename, topk=1):
f.flush()


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.lowest = 1e10

Expand All @@ -242,7 +242,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(train_data, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_seq2seq_autotitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def just_show():
print()


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.lowest = 1e10

Expand All @@ -131,7 +131,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(txts, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_seq2seq_autotitle_csl.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def generate(self, text, topk=1):
autotitle = AutoTitle(start_id=None, end_id=tokenizer._token_end_id, maxlen=32)


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.rouge = Rouge()
self.smooth = SmoothingFunction().method1
Expand Down Expand Up @@ -163,7 +163,7 @@ def evaluate(self, data, topk=1):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(train_data, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_sequence_labeling_cws_crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def predict_to_file(in_file, out_file):
fw.close()


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.best_val_acc = 0

Expand All @@ -202,7 +202,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(train_data, batch_size)

model.fit_generator(
Expand Down
4 changes: 2 additions & 2 deletions examples/task_sequence_labeling_ner_crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def evaluate(data):
return f1, precision, recall


class Evaluate(keras.callbacks.Callback):
class Evaluator(keras.callbacks.Callback):
def __init__(self):
self.best_val_f1 = 0

Expand All @@ -207,7 +207,7 @@ def on_epoch_end(self, epoch, logs=None):

if __name__ == '__main__':

evaluator = Evaluate()
evaluator = Evaluator()
train_generator = data_generator(train_data, batch_size)

model.fit_generator(
Expand Down

0 comments on commit be69691

Please sign in to comment.