Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
use create_module to create CharacterEmbedding (#920)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #920

Using `create_module`, instead of initializing directly, enables the module to be loaded / saved.

Reviewed By: liaimi

Differential Revision: D16906014

fbshipit-source-id: 048fb0c220b05698d4abe3eaaa0a5448c926c816
  • Loading branch information
Michael Wu authored and facebook-github-bot committed Aug 21, 2019
1 parent 19bb1f2 commit 2db0cc9
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pytext/models/doc_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,8 @@ def create_embedding(cls, config, tensorizers: Dict[str, Tensorizer]):
tensorizer=tensorizers["tokens"],
init_from_saved_state=config.init_from_saved_state,
)
byte_embedding = CharacterEmbedding(
ByteTokenTensorizer.NUM_BYTES,
config.byte_embedding.embed_dim,
config.byte_embedding.cnn.kernel_num,
config.byte_embedding.cnn.kernel_sizes,
config.byte_embedding.highway_layers,
config.byte_embedding.projection_dim,
byte_embedding = create_module(
config.byte_embedding, vocab_size=ByteTokenTensorizer.NUM_BYTES
)
return EmbeddingList([word_embedding, byte_embedding], concat=True)

Expand Down

0 comments on commit 2db0cc9

Please sign in to comment.