def train_epoch(self, epoch_info, source: '<STR_LIT>', interactive=True):
self.train()<EOL>if interactive:<EOL><INDENT>iterator = tqdm.tqdm(source.train_loader(), desc="<STR_LIT>", unit="<STR_LIT>", file=sys.stdout)<EOL><DEDENT>else:<EOL><INDENT>iterator = source.train_loader()<EOL><DEDENT>for batch_idx, (data, target) in enumerate(iterator):<EOL><INDENT>batch_info = BatchInfo(epoch_info, batch_idx)<EOL>batch_info.on_batch_begin()<EOL>self.train_batch(batch_info, data, target)<EOL>batch_info.on_batch_end()<EOL>iterator.set_postfix(loss=epoch_info.result_accumulator.intermediate_value('<STR_LIT>'))<EOL><DEDENT>
Run a single training epoch