Skip to content

Commit

Permalink
fix anneal plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
helpmefindaname committed Oct 11, 2023
1 parent df71f85 commit a290eb4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
2 changes: 0 additions & 2 deletions flair/trainers/plugins/functional/anneal_on_plateau.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,4 @@ def get_state(self) -> Dict[str, Any]:
"patience": self.patience,
"initial_extra_patience": self.initial_extra_patience,
"anneal_with_restarts": self.anneal_with_restarts,
"bad_epochs": self.scheduler.num_bad_epochs,
"current_best": self.scheduler.best,
}
27 changes: 27 additions & 0 deletions test_emb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from flair.data import Sentence
from flair.embeddings import TransformerWordEmbeddings

phrase_0 = Sentence("a uui")
embeddings_a = TransformerWordEmbeddings(
'roberta-base',
use_context=True,
use_context_separator=False,
)
ebd_a = embeddings_a.embed(phrase_0)

phrase_1 = Sentence("a uui")
embeddings_b = TransformerWordEmbeddings(
'roberta-base',
use_context=True,
use_context_separator=False,
)
ebd_b = embeddings_b.embed(phrase_1)
ebd_b = [phrase_1]
ebd_a = [phrase_0]

print(
"token run 0:", ebd_a[-1][-1], "\n",
"embedding end run 0:", ebd_a[-1][-1].embedding.tolist()[-2:], "\n",
"token run 1: ", ebd_b[-1][-1], "\n",
"embedding end run 1:", ebd_b[-1][-1].embedding.tolist()[-2:]
)

0 comments on commit a290eb4

Please sign in to comment.