Browse Source

Update stack_embedding.py

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

+ 2
- 2
fastNLP/embeddings/stack_embedding.py View File

@@ -17,7 +17,7 @@ class StackEmbedding(TokenEmbedding):
>>> from fastNLP import Vocabulary
>>> from fastNLP.embeddings import StaticEmbedding
>>> vocab = Vocabulary().add_word_lst("The whether is good .".split())
>>> embed_1 = StaticEmbedding(vocab, model_dir_or_name='en-glove-6b-50', requires_grad=True)
>>> embed_1 = StaticEmbedding(vocab, model_dir_or_name='en-glove-6b-50d', requires_grad=True)
>>> embed_2 = StaticEmbedding(vocab, model_dir_or_name='en-word2vec-300', requires_grad=True)

:param embeds: 一个由若干个TokenEmbedding组成的list,要求每一个TokenEmbedding的词表都保持一致
@@ -91,4 +91,4 @@ class StackEmbedding(TokenEmbedding):
for embed in self.embeds:
outputs.append(embed(words))
outputs = self.dropout(torch.cat(outputs, dim=-1))
return outputs
return outputs

Loading…
Cancel
Save