Browse Source

Merge branch 'master' of github.com:fastnlp/fastNLP

tags/v0.5.5
yh_cc 5 years ago
parent
commit
3683fd5bdd
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      fastNLP/embeddings/roberta_embedding.py

+ 1
- 1
fastNLP/embeddings/roberta_embedding.py View File

@@ -40,7 +40,7 @@ class RobertaEmbedding(ContextualEmbedding):
>>> from fastNLP import Vocabulary
>>> from fastNLP.embeddings import RobertaEmbedding
>>> vocab = Vocabulary().add_word_lst("The whether is good .".split())
>>> embed = RobertaEmbedding(vocab, model_dir_or_name='en-base-uncased', requires_grad=False, layers='4,-2,-1')
>>> embed = RobertaEmbedding(vocab, model_dir_or_name='en', requires_grad=False, layers='4,-2,-1')
>>> words = torch.LongTensor([[vocab.to_index(word) for word in "The whether is good .".split()]])
>>> outputs = embed(words)
>>> outputs.size()


Loading…
Cancel
Save