def train(self, optimizer,
training_set: Iterable[Tuple[QASetting, List[Answer]]],
batch_size: int, max_epochs=10, hooks=tuple(),
l2=0.0, clip=None, clip_op=tf.clip_by_value, summary_writer=None, **kwargs):
"""
This method trains the reader (and changes its state).
Args:
optimizer: TF optimizer
training_set: the training instances.
batch_size: size of training batches
max_epochs: maximum number of epochs
hooks: TrainingHook implementations that are called after epochs and batches
l2: whether to use l2 regularization
clip: whether to apply gradient clipping and at which value
clip_op: operation to perform for clipping
"""
batches, loss, min_op, summaries = self._setup_training(
batch_size, clip, optimizer, training_set, summary_writer, l2, clip_op, **kwargs)
self._train_loop(min_op, loss, batches, hooks, max_epochs, summaries, summary_writer, **kwargs)
评论列表
文章目录