Skip to content

Commit

Permalink
flairNLPGH-1344: Fix logging errors
Browse files Browse the repository at this point in the history
Log new parameter values only for SequenceTagger instances
  • Loading branch information
klasocki committed Jan 11, 2020
1 parent e3d3233 commit 97becbf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions flair/trainers/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
Result,
store_embeddings,
)
from flair.models import SequenceTagger
import random

log = logging.getLogger("flair")
Expand Down Expand Up @@ -172,11 +173,12 @@ def train(
log.info(f"Device: {flair.device}")
log_line(log)
log.info(f"Embeddings storage mode: {embeddings_storage_mode}")
log.info(f"Using F-score with beta: {self.model.beta}")
log.info(f"Weight tensor: {self.model.weights}")
if self.model.weights and self.model.use_crf:
log_line(log)
log.warning(f'Warning: Specified class weights will not take effect when using CRF')
if isinstance(self.model, SequenceTagger):
log.info(f"Using F-score with beta: {self.model.beta}")
log.info(f"Weight tensor: {self.model.weights}")
if self.model.weights and self.model.use_crf:
log_line(log)
log.warning(f'Warning: Specified class weights will not take effect when using CRF')

# determine what splits (train, dev, test) to evaluate and log
log_train = True if monitor_train else False
Expand Down

0 comments on commit 97becbf

Please sign in to comment.