Skip to content

Commit

Permalink
Merge pull request #3477 from flairNLP/store-name-of-charachter-embed…
Browse files Browse the repository at this point in the history
…dings

character embeddings store their embedding name too
  • Loading branch information
alanakbik committed Jul 13, 2024
2 parents c6a2643 + feebc36 commit 472b2c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ venv.bak/
resources/taggers/
regression_train/
/doc_build/

scripts/
4 changes: 3 additions & 1 deletion flair/embeddings/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,14 @@ def __init__(
path_to_char_dict: Optional[Union[str, Dictionary]] = None,
char_embedding_dim: int = 25,
hidden_size_char: int = 25,
name: str = "Char",
) -> None:
"""Instantiates a bidirectional lstm layer toi encode words by their character representation.
Uses the default character dictionary if none provided.
"""
super().__init__()
self.name = "Char"
self.name = name
self.static_embeddings = False
self.instance_parameters = self.get_instance_parameters(locals=locals())

Expand Down Expand Up @@ -556,6 +557,7 @@ def to_params(self) -> Dict[str, Any]:
"path_to_char_dict": self.char_dictionary,
"char_embedding_dim": self.char_embedding_dim,
"hidden_size_char": self.hidden_size_char,
"name": self.name,
}


Expand Down

0 comments on commit 472b2c7

Please sign in to comment.