Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

character embeddings store their embedding name too #3477

Merged
merged 4 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading