Skip to content

Commit

Permalink
Merge pull request #834 from zalandoresearch/GH-833-CharacterEmbeddings
Browse files Browse the repository at this point in the history
GH-833: added parameters to CharacterEmbedding constructor to modify embedding size and hidden state size
  • Loading branch information
Alan Akbik authored Jun 24, 2019
2 parents 525ded1 + 4e2bd33 commit 063ff09
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flair/embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ def __str__(self):
class CharacterEmbeddings(TokenEmbeddings):
"""Character embeddings of words, as proposed in Lample et al., 2016."""

def __init__(self, path_to_char_dict: str = None):
def __init__(self, path_to_char_dict: str = None, char_embedding_dim: int = 25, hidden_size_char: int = 25):
"""Uses the default character dictionary if none provided."""

super().__init__()
Expand All @@ -847,8 +847,8 @@ def __init__(self, path_to_char_dict: str = None):
path_to_char_dict
)

self.char_embedding_dim: int = 25
self.hidden_size_char: int = 25
self.char_embedding_dim: int = char_embedding_dim
self.hidden_size_char: int = hidden_size_char
self.char_embedding = torch.nn.Embedding(
len(self.char_dictionary.item2idx), self.char_embedding_dim
)
Expand Down

0 comments on commit 063ff09

Please sign in to comment.