Skip to content

Commit

Permalink
GH-212: Update log_line
Browse files Browse the repository at this point in the history
  • Loading branch information
tabergma committed Nov 28, 2018
1 parent 470fa33 commit c5e14a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
6 changes: 3 additions & 3 deletions flair/trainers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ def find_learning_rate(self,
f.write(f'{itr}\t{datetime.datetime.now():%H:%M:%S}\t{learning_rate}\t{loss_item}\n')

if stop_early and loss_item > 4 * best_loss:
log_line()
log_line(log)
log.info('loss diverged - stopping early!')
break

self.model.load_state_dict(model_state)
self.model.to(model_device)

log_line()
log_line(log)
log.info(f'learning rate finder finished - plot {learning_rate_tsv}')
log_line()
log_line(log)

return Path(learning_rate_tsv)

Expand Down
10 changes: 2 additions & 8 deletions flair/training_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
from functools import reduce


log = logging.getLogger(__name__)


class Metric(object):

def __init__(self, name):
Expand Down Expand Up @@ -232,8 +229,5 @@ def convert_labels_to_one_hot(label_list: List[List[str]], label_dict: Dictionar
return [[1 if l in labels else 0 for l in label_dict.get_items()] for labels in label_list]


def log_line(logger = None):
if logger is not None:
logger.info('-' * 100)
else:
log.info('-' * 100)
def log_line(logger):
logger.info('-' * 100)

0 comments on commit c5e14a8

Please sign in to comment.