Browse Source

Update elmo_embedding.py

tags/v0.4.10
zide05 GitHub 6 years ago
parent
commit
3eb986f86f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      fastNLP/embeddings/elmo_embedding.py

+ 3
- 0
fastNLP/embeddings/elmo_embedding.py View File

@@ -21,6 +21,9 @@ class ElmoEmbedding(ContextualEmbedding):


Example:: Example::
>>> import torch
>>> from fastNLP import Vocabulary
>>> from fastNLP.embeddings import ElmoEmbedding
>>> vocab = Vocabulary().add_word_lst("The whether is good .".split()) >>> vocab = Vocabulary().add_word_lst("The whether is good .".split())
>>> # 使用不同层的concat的结果 >>> # 使用不同层的concat的结果
>>> embed = ElmoEmbedding(vocab, model_dir_or_name='en', layers='1,2', requires_grad=False) >>> embed = ElmoEmbedding(vocab, model_dir_or_name='en', layers='1,2', requires_grad=False)


Loading…
Cancel
Save